How can i append new xml node to xmltype doc with updatexml and xpath?

ex. content of column:
<xmldoc>
<xmlnode attr="x" value="x1"/>
<xmlnode attr="y" value="y1"/>
</xmldoc>
needed to be:
<xmldoc>
<xmlnode attr="x" value="x1"/>
<xmlnode attr="y" value="y1"/>
<xmlnode attr="z" value="z1"/>
<xmldoc/>
how can i do this with updatexml without rewriting all xmlnode-elements?

You have to specify the DTD in the transformation. If you are using XSLT then you do that on your <xsl:output>. Otherwise you need to give more details.

Similar Messages

  • How can I write new objects to the existing file with already written objec

    Hi,
    I've got a problem in my app.
    Namely, my app stores data as objects written to the files. Everything is OK, when I write some data (objects of a class defined by me) to the file (by using writeObject method from ObjectOutputStream) and then I'm reading it sequencially by the corresponding readObject method (from ObjectInputStream).
    Problems start when I add new objects to the already existing file (to the end of this file). Then, when I'm trying to read newly written data, I get an exception:
    java.io.StreamCorruptedException
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readObject(Unknown Source)
    Is there any method to avoid corrupting the stream? Maybe it is a silly problem, but I really can't cope with it! How can I write new objects to the existing file with already written objects?
    If anyone of you know something about this issue, please help!
    Jai

    Here is a piece of sample codes. You can save the bytes read from the object by invoking save(byte[] b), and load the last inserted object by invoking load.
    * Created on 2004-12-23
    package com.cpic.msgbus.monitor.util.cachequeue;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.RandomAccessFile;
    * @author elgs This is a very high performance implemention of Cache.
    public class StackCache implements Cache
        protected long             seed    = 0;
        protected RandomAccessFile raf;
        protected int              count;
        protected String           cacheDeviceName;
        protected Adapter          adapter;
        protected long             pointer = 0;
        protected File             f;
        public StackCache(String name) throws IOException
            cacheDeviceName = name;
            f = new File(Const.cacheHome + name);
            raf = new RandomAccessFile(f, "rw");
            if (raf.length() == 0)
                raf.writeLong(0L);
         * Whne the cache file is getting large in size and may there be fragments,
         * we should do a shrink.
        public synchronized void shrink() throws IOException
            int BUF = 8192;
            long pointer = getPointer();
            long size = pointer + 4;
            File temp = new File(Const.cacheHome + getCacheDeviceName() + ".shrink");
            FileInputStream in = new FileInputStream(f);
            FileOutputStream out = new FileOutputStream(temp);
            byte[] buf = new byte[BUF];
            long runs = size / BUF;
            int mode = (int) size % BUF;
            for (long l = 0; l < runs; ++l)
                in.read(buf);
                out.write(buf);
            in.read(buf, 0, mode);
            out.write(buf, 0, mode);
            out.flush();
            out.close();
            in.close();
            raf.close();
            f.delete();
            temp.renameTo(f);
            raf = new RandomAccessFile(f, "rw");
        private synchronized long getPointer() throws IOException
            long l = raf.getFilePointer();
            raf.seek(0);
            long pointer = raf.readLong();
            raf.seek(l);
            return pointer < 8 ? 4 : pointer;
         * (non-Javadoc)
         * @see com.cpic.msgbus.monitor.util.cachequeue.Cache#load()
        public synchronized byte[] load() throws IOException
            pointer = getPointer();
            if (pointer < 8)
                return null;
            raf.seek(pointer);
            int length = raf.readInt();
            pointer = pointer - length - 4;
            raf.seek(0);
            raf.writeLong(pointer);
            byte[] b = new byte[length];
            raf.seek(pointer + 4);
            raf.read(b);
            --count;
            return b;
         * (non-Javadoc)
         * @see com.cpic.msgbus.monitor.util.cachequeue.Cache#save(byte[])
        public synchronized void save(byte[] b) throws IOException
            pointer = getPointer();
            int length = b.length;
            pointer += 4;
            raf.seek(pointer);
            raf.write(b);
            raf.writeInt(length);
            pointer = raf.getFilePointer() - 4;
            raf.seek(0);
            raf.writeLong(pointer);
            ++count;
         * (non-Javadoc)
         * @see com.cpic.msgbus.monitor.util.cachequeue.Cache#getCachedObjectsCount()
        public synchronized int getCachedObjectsCount()
            return count;
         * (non-Javadoc)
         * @see com.cpic.msgbus.monitor.util.cachequeue.Cache#getCacheDeviceName()
        public String getCacheDeviceName()
            return cacheDeviceName;
    }

  • How can I connect a Sony DCR-PC110 video camera with iMovie and import my videos?

    How can I connect my Sony video camera DCR-PC110 with iMovie in order to import my old videos?

    Hi
    This Camera has three types of ports.
    - Analog-out
    - USB
    - I.Link = FireWire = IEEE1394 = Digital in/out = DV-terminal
    And Your Camera only can send Photos via the USB-connection - NO VIDEO.
    So You Must get a FireWire Cable and eventually a ThunderBolt/FireWire converter Cable to get Import to work.
    There are no real way around this.
    Yours Bengt W

  • HT3529 How can I get dictation for my iPad for use with email and messaging

    How can I get dictation to use with messaging and email?

    Apple's dictation requires Siri, which requires a 3rd or 4th generation iPad (or iPad Mini).  See:
    http://support.apple.com/kb/HT5457
    Your post says you have a second generation iPad, so it will not have dictation.
    There are third party apps available that might help you.

  • How can I append an XML to SOAPHeader

    Basically what I need to do is set the XML, I have to the SOAP Header.
    Here is what I am trying to do.
    MessageFactory factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
    message = factory.createMessage();
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    dbf.setNamespaceAware(true);
    InputStream headeris = new ByteArrayInputStream(getXMLasString(headerXml).getBytes());
    Document doc = dbf.newDocumentBuilder().parse(headeris);
    Node tmp=doc.getFirstChild();
    message.getSOAPPart().getEnvelope().getHeader().appendChild(tmp);
    I get the following exception:
    org.w3c.dom.DOMException: WRONG_DOCUMENT_ERR: A node is used in a different document than the one that created it.
    at com.sun.org.apache.xerces.internal.dom.ParentNode.internalInsertBefore(ParentNode.java:389)
    at com.sun.org.apache.xerces.internal.dom.ParentNode.insertBefore(ParentNode.java:321)
    at com.sun.org.apache.xerces.internal.dom.NodeImpl.appendChild(NodeImpl.java:275)
    at DispatchClient.main(DispatchClient.java:86)
    Thanks in Advance.
    Raju

    The documentation provides all you need :
    http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb04cre.htm#ADXDB4269
    SQL> with sample_data as (
      2    select xmltype('<document/>') metadata
      3    from dual
      4  )
      5  select insertchildxml(metadata, '/document', '@newid', '2')
      6  from sample_data
      7  ;
    INSERTCHILDXML(METADATA,'/DOCU
    <document newid="2"/>

  • I got a new lenovo desktop windows 8.1,installed itunes and synced my ihone 4 no problems. then i imported a cd of songs which showed up in recently added but not in main library ,therefore it did not sync to the iphone. how can i get new songs to ap

    i got a new lenovo desktop windows 8.1,installed itunes and synced my iphone 4 no problems. then i imported a cd of songs which showed up in recently added but not in main library ,therefore it did not sync to the iphone. how can i get new songs to appear in the main library and sync properly
    thanks
    john

    Check the songs are really not in the Music section of the library by clicking the magnifying glass in the search box and unticking Search Entire Library if it is ticked, then typing in the name of the album. If the tracks still don't show try closing iTunes and deleting a hidden file called sentinel from inside your iTunes folder. This should make iTunes run an integrity check on the database when you start it again. Make sure the tracks are checked before you try syncing again.
    tt2

  • How can I concatenate a currency field (eg: 12.25) with numeric values

    Hi,
    I ma working in ECC6.0.
    How can I concatenate a currency field (eg: 12.25) with numeric and character values into a variable.
    I want to concatenate 12.25  with  "+"  and  "0".
    Regard,
    Divya

    Hi,
    I ma working in ECC6.0.
    How can I concatenate a currency field (eg: 12.25) with numeric and character values into a variable.
    I want to concatenate 12.25 with "+" and "0".
    Regard,
    Divya
    ==================================
    data: l_string type string.
    move l_curr_field to l_string.
    condense l_string no-gaps.     "if needed
    concatenate l_string '+' '0' into l_string.
    now your l_string will have all the values.

  • How can I get the XML structure from a flat structure?

    Hi all,
    in my XI SP 12 I use a JMS adapter to read information using the WebSphereMQ transport protocol.
    The structure that I receive have this format:
    <Name_A.KeyFieldValue><Name_A.fieldName_A1_Value>...<Name_A.fieldName_AN_Value>
    <NumberRecordType_B><NumberRecordType_c>
    <Name_B.KeyFieldValue><Name_B.fieldName_B1_Value>...<Name_B.fieldName_BN_Value>
    <Name_B.KeyFieldValue><Name_B.fieldName_B1_Value>...<Name_B.fieldName_BN_Value>
    <Name_C.KeyFieldValue><Name_C.fieldName_C1_Value>...<Name_C.fieldName_CN_Value>
    <Name_C.KeyFieldValue><Name_C.fieldName_C1_Value>...<Name_C.fieldName_CN_Value>
    the problem is that in this structure each line is not separated by a carriage return or a comma, I have all the information in a single line:
    <Name_A.KeyFieldValue><Name_A.fieldName_A1_Value>...<Name_A.fieldName_AN_Value><NumberRecordType_B><NumberRecordType_c><Name_B.KeyFieldValue><Name_B.fieldName_B1_Value>...<Name_B.fieldName_BN_Value>...<Name_B.KeyFieldValue><Name_B.fieldName_B1_Value>...<Name_B.fieldName_BN_Value><Name_C.KeyFieldValue><Name_C.fieldName_C1_Value>...<Name_C.fieldName_CN_Value>...<Name_C.KeyFieldValue><Name_C.fieldName_C1_Value>...<Name_C.fieldName_CN_Value>
    and the customer don't want to insert a line separator.
    Then, the question is:
    How can I get the XML structure from this structure?
    If possible, I don't want to develop new Module and add it in the JMS Module Sequence.
    PS I have already read the article "How to Use the Content Conversion Module with the XI 3 J2EE JMS Adapter.pdf" and it doesn't seem to help me.
    Best Regards,
    Paolo

    To get context parameters from your web.xml file you can simply get the ActionServlet object from an implementing action object class. In the perform (or execute) method make the following call.
    ServletContext context = getServlet().getServletContext();
    String tempContextVar =
    context.getInitParameter("<your context param >");

  • How can I make a "property node" for a VI?

    Hello!
    If I add a boolean button on the FP then I am able to make a property node for that button in the Block Diagram. But how can I make a property node for a VI? I have several VI:s an that together is one program. What I need to do is to verify what kind of VI some of my VI:s is. I need to verify if it is .exe or .vi-file, and if it is .exe then I want to disable run, abort, run continuously bottons otherwise not. I have hard that this is possible to do programmaticaly but I can´t figure out how. I am aware that I could do that manually in the File->vi properties->customize->windows appearance but theese choises makes it last forever.
    I want to be able to stop and run and everything if it is a .vi file, but if it is .exe-file then all those buttons should be disabled.
    Anyone have an example on this?
    In an other message at this Forum I read "You can use the `Front Panel Window. Allow Runtime PopUp`" property to disable run-time shortcuts menues programmaticaly, but still I dont know how to create this property node.
    /Amir

    You really shouldn't open a new thread. If you don't understand something, ask and we will explain it.
    Like I said in the other thread, you can check if you are running in LV or an EXE by using the Application>>Kind property. To get it, place a property node (from the Application Control palette) on the diagram, click it and find the property.
    To set the properties for the VI, place another property node, right click it and select Select Class>>VI Server>>VI. You should have the properties you want under Front Panel Window.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf). I believe chapter 17 of the user manual explains about programmatic control of VIs.
    Try to take over the world!

  • PSE 6 layer styles - how can I load new styles?

    PSE 6 layer styles - how can I load new styles?

    Hi,
    You need to download styles and then paste them to C:\ProgramData\Adobe\Photoshop Elements\8.0\Photo Creations\layer styles.
    You need to have a
    1) .asl file
    2) metadata.xml file.
    Relaunch  the application after this. the styles would be visible.
    In case you dont see them just go to C:\ProgramData\Adobe\Photoshop Elements\8.0\Locale\en_us and delete "MediaDatabase.db3" file.
    For XP:
    Copy the styles to C:\Documents and Settings\All Users\Application Data\Adobe\Photoshop Elements\8.0\Photo Creations\layer styles
    and delete the "MediaDatabase.db3" file. at C:\Documents and Settings\All Users\Application Data\Adobe\Photoshop Elements\8.0\Locale\en_US.
    For MAC :
    /Volumes/OS<name of Disk>/Library/Application Support/Adobe/Photoshop Elements/8.0/Photo Creations/Layer styles.
    and delete the "MediaDatabase.db3" file. at   /Volumes/OS<name of Disk>/Library/Application Support/Adobe/Photoshop Elements/8.0/Locale/en_US
    Hope this helps.

  • How can (parse) i use XML file with missing EndTag

    hi,
    i have an application which writes an "XML file".
    another application should read that XML file, build an DOM and
    access the nodes with xpath.
    my problem. if the first application is not finished there are tags
    missing. e.g. </xml>. but the seconds application cannot wait until the first application finishes it task.
    if i now read the XML file the parser cannot load it because the end tags are missing.
    my question:
    how can i deactivate the check or how can i read the XML file and access it via XPath (my application is using at the moment XPath to access the nodes and i dont want to change that)
    as parser i am using XERCES
    alex

    As far as I know, you can't do this - xml must be well formed (this is sort of a bedrock of xml). There may be some work around's, but I'm not aware of any - and they would most likely be hacks.

  • How can i change the particular node color in Jtree?

    I have constructed the tree.i dont know how to set the color for the particular node then how can i change the particular node icon depends on some conditions like if we will give the input whether it is available in jtree that node icon only changed.Anyone please help me as soon as possible.

    hi,
    i saw that tutorial.from that book i dont get the particular node cell renderer.i got a cell renderer for tree only.i attached my code in this mail.pls see and help me if u will do
    mport pack.Prop;
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Font;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.util.Properties;
    import java.util.Set;
    import java.util.StringTokenizer;
    import java.util.Vector;
    import javax.swing.Icon;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JScrollPane;
    import javax.swing.JTree;
    import javax.swing.UIManager;
    import javax.swing.text.Position;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.MutableTreeNode;
    import javax.swing.tree.TreeCellRenderer;
    import javax.swing.tree.TreePath;
    public class ReadProperty3 extends JFrame{
    String str,key;
    static JTree tree;
    static Vector v;
    StringTokenizer st;
    static DefaultMutableTreeNode root;
    DefaultMutableTreeNode t;     
    public Object[] o;
    public static void main(String[] args) throws IOException {
    ReadProperty3 r = new ReadProperty3();
    Prop p=new Prop();
    JFrame f=new JFrame();
    p.show();
    Object[] o=v.toArray();
    int startRow = 0;
    String prefix =p.s;
    TreePath path = tree.getNextMatch(prefix, startRow, Position.Bias.Forward);
    //if(prefix.equals(root.getChildAt(0).toString()))
    if(prefix.equals("2000"))
         System.out.println("Node 2000 found");
         else if(prefix.equals("3000"))
              System.out.println("Node 3000 found");
         else if(prefix.equals("4000"))
              System.out.println("Node 4000 found");
         else
              System.out.println("Node not found");
         for(int i=0;i<v.size();i++)
              //((DefaultTreeModel)tree.getModel()).reload();
              DefaultTreeCellRenderer ren=(DefaultTreeCellRenderer)tree.getCellRenderer();
              Icon openIcon = new ImageIcon("C:/apache-tomcat-5.5.12/webapps/jsp-examples/images/execute.gif");
              Icon closedIcon = new ImageIcon("C:/apache-tomcat-5.5.12/webapps/jsp-examples/images/execute.gif");
              Icon leafIcon = new ImageIcon("C:/apache-tomcat-5.5.12/webapps/jsp-examples/images/read.gif");
              if(o[0].equals(p.s))
                   ren.setBackgroundSelectionColor(Color.MAGENTA);
                   ren.setBackgroundNonSelectionColor(Color.YELLOW);
                   //ren.setTextSelectionColor(Color.YELLOW);
                   //ren.setTextNonSelectionColor(Color.BLUE);
                   ren.setClosedIcon(closedIcon);
                   ren.setFont(new Font("Impact",Font.ITALIC,14));
              else if(o[1].equals(p.s))
                   ren.setLeafIcon(leafIcon);
                   ren.setFont(new Font("Impact",Font.ITALIC,10));
                   UIManager.put("Tree.leafIcon", leafIcon);
              else if(o[2].equals(p.s))
                   ren.setOpenIcon(openIcon);
                   ren.setFont(new Font("Dialog",Font.BOLD,9));
    public ReadProperty3(){
         super("JTree With Properties");
         try{
    int c = 0;
    while(c == 0){
    c = 1;
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    System.out.print("Enter file name which has properties extension :");
    str = bf.readLine();
    File f = new File(str + ".properties");
    if(f.exists()){
    Properties pro = new Properties();
    FileInputStream in = new FileInputStream(f);
    pro.load(in);
    System.out.println("Key: " + pro.keySet());
    System.out.print("Enter Key : ");
    key = bf.readLine();
    String p = pro.getProperty(key);
    st = new StringTokenizer(p,"=,");
    root=new DefaultMutableTreeNode(key);
    v=new Vector();
    while(st.hasMoreTokens())
         String val=st.nextToken();
         v.add(val);
         o=v.toArray();
         System.out.println(val);
         t=new DefaultMutableTreeNode(val);
         root.add(t);
         tree=new JTree(root);
         tree.setEditable(true);
         JScrollPane jp=new JScrollPane(tree);
         // tree.setCellRenderer(new CellRenderer());
         Container content=getContentPane();
         content.add(jp,BorderLayout.CENTER);
    setSize(250,275);
    setVisible(true);
    addWindowListener(new ExitListener());
    else{
    c = 0;
    System.out.println("File not found!");
    catch(IOException e){
    System.out.println(e.getMessage());
    }

  • How can i append the variable to filename in import statement?

    how can i append variable(substitution variable) to file name in import command for maxL?
    example : For suppose there is a file like "dataload.txt" and a variable like cur_month(august).How can i rename the file like daload_august in import statement.
    Edited by: 788996 on Aug 22, 2010 11:18 PM

    Are you saying you want to use an OS level environment variable in a MaxL statement to substitute for an entire file name? I am going to illustrate Windows, but do it your own way in *nix if you want.
    YourCallingCode.cmd
    REM Note the \\ and then the \\, you had \\ and \
    SET curmon=c:\\ABC\\datafile_21_AUG.txt 
    REM Call MaxL with a paramenter
    startMaxL.cmd DoItForTheCurrentMonth.msh %curmon%DoItForTheCurrentMonth.msh
    login blah blah for blah ;
    import database appname.dbname data from local text data_file $curmon using server rules_file "rulefile"
         on error abort ;The trick is to change whatever's in % and % and replace it with a $ in the MaxL script.
    I gave a presentation last year on MaxL at ODTUG Kaleidoscope. If you go to http://www.odtug.com, then Tech Resources, then Essbase, then search on my name, you'll find "Master Essbase with MaxL Automation". More than you could ever want to know about MaxL, variables (parameter, environment, and explicitly declared), scripting, etc., etc., are all there for the taking. If you're not already a member, you'll have to join, but an associate membership is free. You can then download my presentation and all of the others. It is a treasure chest of technical tips and knowledge.
    Yes, I am a fan a member of the Hyperion SIG, so I am ever so slightly biased. Regardless, it is good information, for free.
    Regards,
    Cameron Lackpour
    Edited by: CL on Aug 24, 2010 5:33 AM
    If you want to substitute part of the data file name, you can do that too:
    set curmon=21_AUG
    Your MaxL statement would look like:
    import database appname.dbname data from local text data_file "c:\\ABC\\datafile_$curmon.txt" using server rules_file "rulefile"
         on error abort ;

  • How can we append data in existing flat file

    how can we append data to a existing flat file (Text file).

    just fill the itab from data which suppose to append to text file.than read text file from GUI_UPLOAD and loop on itab and with the use of read statements you may append the data.

  • How can I install new windows on NB200-10z without a CD drive?

    Hi,
    I have a mini laptop "Toshiba nb200-10z" and it doesnt startup anymore.
    I would like to do a recovery, but it also doesnt work.
    I know there is a shortcut like press the 0 button when the laptop is starting up.
    With this shortcut you can start the recovery to reset the software.
    But when I press the 0 button it gives me an error.
    So I think the recovery drive/partition is lost.
    How can I install new windows on this minilaptop without a CD drive?

    I have found a much easier way to install Windows 7 from a USB Flash drive. Unlike other methods where you have to write complicated commands, this method can be completed even by those who have very little computer background.
    The whole process takes only two steps, run UNetbootin, load the Windows 7 ISO file, and finally restart your computer.
    Before you begin, you will require the following:
    USB Flash Drive (4GB minimum)
    Windows 7 ISO Image file
    UNetbootin
    Note: If UNetbootin doesnt work, try out the Microsofts official tool called Windows 7 USB/DVD Tool.
    Now insert the USB drive, run UNetbootin, and select Disk Image as ISO. Browse your local drive for Windows 7 ISO that you downloaded and click Open. Now Select Type as USB and choose the drive. Once done, it will look like a bit similar to the screenshot shown below.
    Click OK and it will begin extracting all installation files to the USB drive. The whole process will take some time (10-15 minutes), so have patience.
    Once the installation is complete, reboot your computer. Now while your system is starting up press the appropriate button (usually F1, F2, F12, ESC, Backspace, or Escape) to bring up Bios Boot Menu.
    Change the startup order to boot USB by default, usually you will have to press F6 to move the selected USB device on top. Once done, save changes and restart the system.
    +Message was edited: link has been removed+

Maybe you are looking for

  • Can I cut-off New G/L migration date during fiscal year ?

    Dear Experts     I know that the principles of migration date of New G/L migration should be on first day of fiscal year and Year-end closing of the old fiscal year must be complete before New General Ledger Accounting is activated.     However, if I

  • Assigning duke dollars

    How do I award Duke dollars to the best respondent to my question?

  • System Memory Errors

    I've recently begun getting "Out of System Memory" messages with all my active applications Paused.  What is causing this?  How can I increase System Memory.  (Note, it doesn't say "Application Memory") ?????

  • Issues in ICS update for Xperia Arc

    I am using Xperia Arc. I have done the ICS update recently and I am totally disappointed with this update. The thing is some features already there in the 2.3.4 version of android is not there in ICS update. When long press the power button 'take scr

  • Acrobat 8.2 update problem

    Let me start by saying that if I am the only one who was affected by this, I apologize for taking up your time. Having said that, I installed the 8.2 update for Acrobat Pro yesterday afternoon (January 14). I use Creative Suite versions CS through CS