How to add tags to the existing XML file?

Hi,
I have a requirement wherein I have to add a tag to the existing xml data.
For Eg:
<ROW>
<EVNT_ID>7333976</EVNT_ID>
<DISTRCT_CD>67</DISTRCT_CD>
<TIME_OFF>06-May-2008 10:50:04 AM</TIME_OFF>
</ROW>
The desired output is,
<DI_DATA>
<ROW>
<EVNT_ID>7333976</EVNT_ID>
<DISTRCT_CD>67</DISTRCT_CD>
<TIME_OFF>06-May-2008 10:50:04 AM</TIME_OFF>
</ROW>
</DI_DATA>
I have to add <DI_DATA> </DI_DATA>at the start and end of the input.
Could any of you help me on this?
Thanks,
GV

If your XML is just in a CLOB, you can just use string manipulation to prepend/append the nodes on. If you have it in an XMLType you could just do the following
select appendchildxml(XMLTYPE('<DI_DATA/>'),
                              'DI_DATA',
                              XMLTYPE('<ROW>
<EVNT_ID>7333976</EVNT_ID>
<DISTRCT_CD>67</DISTRCT_CD>
<TIME_OFF>06-May-2008 10:50:04 AM</TIME_OFF>
</ROW>'))  -- this would be your variable
  from dual;which will put your data within the DI_DATA node.

Similar Messages

  • How to add subpartitions to the existing subpartition template

    Hi All,
    My Question is ,how to add Subpartition to the exiting subpartition template. e
    like i have created a table with subpartition template with with 5 subpartitions like
    subpartiton one_1 value (121)
    subpartition two_2 value(122)
    and now i one to add one more subpartitin to the existing subpartition template(Like modify the existing subpartition templete).
    subpartition three_3 value(123)
    Could any suggest me.
    Thanks
    Sree

    >
    My Question is ,how to add Subpartition to the exiting subpartition template.
    >
    Follow the example in the section for 'Modifying a Subpartition Template' in the VLDB and Partitioning Guide
    http://docs.oracle.com/cd/E11882_01/server.112/e25523/part_admin002.htm#i1007904
    >
    You can modify a subpartition template of a composite partitioned table by replacing it with a new subpartition template. Any subsequent operations that use the subpartition template (such as ADD PARTITION or MERGE PARTITIONS) now use the new subpartition template. Existing subpartitions remain unchanged.
    If you modify a subpartition template of an interval-* composite partitioned table, then interval partitions that have not yet been created use the new subpartition template.
    Use the ALTER TABLE ... SET SUBPARTITION TEMPLATE statement to specify a new subpartition template. For example:
    ALTER TABLE emp_sub_template
    SET SUBPARTITION TEMPLATE
    (SUBPARTITION e TABLESPACE ts1,
    SUBPARTITION f TABLESPACE ts2,
    SUBPARTITION g TABLESPACE ts3,
    SUBPARTITION h TABLESPACE ts4

  • How to update Elements value inside existing xml file

    Hi Gurus,
    Am somehow new to java and working on xml with java, i have a scenario where i want to update the elements of my existing xml file, i know its possible as i have posted one code on this forum which updates the values of the arrtibutes of existing xml file. Ref :
    http://forum.java.sun.com/thread.jsp?forum=34&thread=186091&start=15&range=15&hilite=false&q=
    But am not able to use the same code to update the vlaues of the attribute.
    if i have this xml file :
    <?xml version="1.0"?>
    <RootElement>
    <Transaction>
    <Task9>
    <TaskID>Task9</TaskID>
    <Description>My Test Case</Description>
    <Time>12/12/2004</Time>
    </Task9>
    </Transaction>
    <Transaction>
    <Task2>
    <TaskID>Task2</TaskID>
    <Description>Testing my xml</Description>
    <Time>12/12/2004</Time>
    </Task2>
    </Transaction>
    </RootElemen>
    Now i want to update teh </Description> and </Time> field using the code that i have given above in the link.
    If any one can help me ill really appreciate.

    The value of an element is stored in a child node of that element. For example, let's say that "e" references the node <Description> then:
    e.getFirstChild().getNodeValue() => "My Test Case"

  • How to add id to the existing Authorization Object

    Hi,
    I want to add one id to the existing Authorization Object,How to add this?
    Here is my Object and existing ID's
    authority-check object 'Z_W2WALL' for user sy-uname
              id 'ZFREEZE' field r_freeze
              id 'ZLI01' field r_li01
              id 'ZLI11' field r_li11
              id 'ZLI14' field r_li14
              id 'ZLI11R' field r_li11n
              id 'ZLI20' field r_li20
              id 'ZMI10' field r_mi10
              id 'ZUPLOAD' field r_upload
              id 'Z_ARTFRZ' field r_artfrz.
    Now for this i want to add
      id 'Z_BIN' field r_frz.
    How to do this?
    Thanks

    Hi Sai,
    as there are already defined other id's have been added, you could also do the same way
    but this will also done through your basis end, where for this id your basis team will provide the
    authority to this id for the same purpose..
    authority-check object 'Z_W2WALL' for user sy-uname
              id 'ZFREEZE' field r_freeze
              id 'ZLI01' field r_li01
              id 'ZLI11' field r_li11
              id 'ZLI14' field r_li14
              id 'ZLI11R' field r_li11n
              id 'ZLI20' field r_li20
              id 'ZMI10' field r_mi10
              id 'Z_BIN' field r_frz
              id 'ZUPLOAD' field r_upload
              id 'Z_ARTFRZ' field r_artfrz.

  • How to create Bar chart  from existing XML file

    Hi all,
    i'm new to flex, i need your help to develop a flex for
    dashboard app. we have sample.xml file. by using this i need to
    create a bar diagram or piechart.
    Please help me out
    The XMl looks like this.....
    <?xml version="1.0" encoding="utf-8"?>
    <user id="123412343">
    <fullName>
    <lastName>Telles</lastName>
    <firstName>vijay</firstName>
    </fullName>
    <preferences>
    <modWidth>235</modWidth>
    <modHeight>250</modHeight>
    <totalWidth>1650</totalWidth>
    <totalHeight>1650</totalHeight>
    <modsX>4</modsX>
    <modsY>2</modsY>
    </preferences>
    <module id="Status2">
    <windowOpen>true</windowOpen>
    <pointsToShow>
    <p label="Proposed"/>
    <p label="Draft"/>
    <p label="DEP Adpt"/>
    <p label="EPA Adpt"/>
    </pointsToShow>
    <dataSetsToShow>
    <label>2006</label>
    <label>2007</label>
    </dataSetsToShow>
    </module>
    </user>

    convert this xml to ArrayCollection called chartData
    var charOption:String = "totalHeight"; /Use this to set the
    yField property...
    <mx:ColumnChart showDataTips="true" id="barChart"
    width="100%" height="100%" dataProvider="{chartData}"
    color="0xffffff">
    <mx:horizontalAxis>
    <mx:CategoryAxis
    dataProvider="{chartData}"
    categoryField="hour" />
    </mx:horizontalAxis>
    <mx:verticalAxis>
    <mx:LinearAxis labelFunction="addDollarSign"/>
    </mx:verticalAxis>
    <mx:series>
    <mx:ColumnSeries yField="{chartOption}"
    showDataEffect="interpolate"
    creationCompleteEffect="interpolate"/>
    </mx:series>
    </mx:ColumnChart>

  • Adding XML tags to an existing XML file

    Hi,
    I am inserting 1 lac records in an XML file after reading it from a database. Situation arises that the operation is aborted (80,000 records already have been inserted) unintentionally because of some problem (network disconnection, power shut down etc ). Is it possible to start filling up the XML file from the location where i had aborted (ie from the 80,001th record), i will be using SAX (As it is faster than DOM) to fill up the file .

    Visit gotoandlearn.com and find a tutorial there for creating
    a preloader.

  • How to add Audio Track to Existing AVI File

    Dear Friends,
    I have a AVI file, which contains only the Video Track.
    Now i want to add Audio track to this existing Video Track AVI File.
    Please suggest me with samples.
    Regards
    Senthil

    Try next:
    Get a datasource from the avi.
    Get a datasource from the audio track.
    Create a MergedDataSource with both.
    Use a datasink to write to a file or play it with a player...

  • Need help getting rid of those ASX:ABAP tags from the generated XML file!

    I was able to transfer xml data from abap internal tables to a string.
    Here is the content of the string:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <asx:abap version="1.0" xmlns:asx="http://www.sap.com/abapxml">
    <asx:values>
    <DATA>
    <item>
    <UOM1 />
    <UOM2>L</UOM2>
    <GL_PR_SEG />
    <RECORDMODE>A</RECORDMODE>
    </item>
    </DATA>
    </asx:values>
    </asx:abap>
    Now my goal is to strip out a couple of tags out of that string directly using xslt.
    Do you know of any way i could take out the <asx:abap> and <asx:values> tags using an xslt program. I'd like to be able to strip them out directly from the string itself.

    its not function. its within abap.
    within your abap program, the xml code is in a string for example xml_string .
    use
    replace all occurrences of '<ASX:ABAP>' in xml_string with '' .
    replace all occurrences of '</ASX:ABAP>' in xml_string with '' .
    replace all occurrences of '<ASX:VALUES>' in xml_string with '' .
    replace all occurrences of '</ASX:VALUES>' in xml_string with '' .
    Hope this solves your issue.
    If your question is answered, reward the helpful answers with points and close the thread.
    Regards
    Raja

  • How to add lens metadata to existing DNG files?

    I shot some images with a fully manual optic, so lens data was not embedded in RAW files, hence they are not existant in DRG files after conversion.
    Is there a way to edit those DNG files in Lightroom so they would include lens name and focal lenght I manually enter?
    Regards,
    Romuald

    >That said, I would love a secret mode for this.
    It's called a Text Editor and it doesn't even and to touch the raw file (i.e.  CR2, NEF, MRW, etc).  Save out the metadata to XMP sidecar, use search and replace to overwrite the lens info, then read the metadata back in Lightroom. Lightroom will use the edited metadata instead of the embedded EXIF data.  I've used this method for years. TextWrangler (Mac) or similar on Windows can run a search/replace on a batch of files (thousands if need be).
    For example:
    Find:
    24.0-70.0 mm
    replaced with
    EF24-70mm f/2.8L USM
    You can't use above method on DNG directly. So, you create and edit the XMP sidecar before converting to DNG.  Either way you're leaving the original Makernotes intact and therefore running no risk of screwing the file.
    At some point in the future it should be possible to skip above and write the lens data directly into the Lightroom database and back to the sidecar or DNG if required. Unfortunately, not this cycle.

  • How do i update an existing XML File?

    Hello, I have the following xml file gps.xml:<?xml version="1.0"?>
    <!DOCTYPE gps SYSTEM "gps.dtd">
    <gps>
       <latitude>43.00000</latitude>
       <longitude>-83.00000</longitude>
    </gps> I already have methods written to get the values. But how can I change these values and update the file to reflect these changes?
    thanks for your help!

    Hi, I already have this following code. I would just like to add a method to it to update the existing XML file with different lat/lon coordinates. Could you please help me out with it? thanks
    import java.io.*;
    import java.io.PrintWriter;
    import java.net.MalformedURLException;
    import java.net.URL;
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import org.xml.sax.*;
    public class Gps implements java.io.Serializable {
        private double latitude_;
        private double longitude_;
        public Gps(Document doc) {
            setup(doc.getDocumentElement());
        public Gps(String uri) throws IOException, SAXException, ParserConfigurationException {
            setup(uri);
        public void setup(Document doc) {
            setup(doc.getDocumentElement());
        public void makeElement(Node parent) {
            Document doc;
            if (parent instanceof Document) {
                doc = (Document)parent;
            } else {
                doc = parent.getOwnerDocument();
            Element element = doc.createElement("gps");
            int size;
            URelaxer.setElementPropertyByDouble(element, "latitude", this.latitude_);
            URelaxer.setElementPropertyByDouble(element, "longitude", this.longitude_);
            parent.appendChild(element);
         public Document makeDocument() throws ParserConfigurationException {
            Document doc = UJAXP.makeDocument();
            makeElement(doc);
            return (doc);
        public final double getLatitude() {
            return (latitude_);
        public final void setLatitude(double latitude) {
            this.latitude_ = latitude;
        public final double getLongitude() {
            return (longitude_);
        public final void setLongitude(double longitude) {
            this.longitude_ = longitude;
       public final void updateXmlFile(double latitude, double longitude) {
         // something???
        public final void updateXmlFile(double latitude, double longitude) {
            this.latitude_ = latitude;
            this.longitude_ = longitude;
        public String makeTextDocument() {
            StringBuffer buffer = new StringBuffer();
            makeTextElement(buffer);
            return (new String(buffer));
        public void makeTextElement(StringBuffer buffer) {
            int size;
            buffer.append("<gps");
            buffer.append(">");
            buffer.append("<latitude>");
            buffer.append(Double.toString(getLatitude()));
            buffer.append("</latitude>");
            buffer.append("<longitude>");
            buffer.append(Double.toString(getLongitude()));
            buffer.append("</longitude>");
            buffer.append("</gps>");
        public String toString() {
            try {
                return (makeTextDocument());
            } catch (Exception e) {
                return (super.toString());
    }

  • How to configure a JNDI ressource in the web.xml file

    Hi,
    does someone know if there is a way to configure a JNDI ressource with its parameters only in the web.xml file ?
    In my case, the JNDI ressouce is an oracle database an its conenction paramters: driverClassName, username, password, etc...
    Actually, I put everything in the configuration file of Tomcat but I would like my war file to be 100% independent of the application server.
    Thanks in advance.
    Fred.

    I wrestled with this for a long time. I may have done something wrong, but to get my mySQL JDNI reference to work, I had to add it to the server.xml file. You can try with web.xml, but I eventually just got frustrated and put it in server.xml.
    The following is between two <context> tags:
    <Resource name="jdbc/instance_name_goes_here"
                   auth="Container"
                   type="javax.sql.DataSource"/>
              <ResourceParams name="jdbc/same_instance_name_here">
                   <parameter>
                        <name>username</name>
                        <value>user_name_goes_here</value>
                   </parameter>
                   <parameter>
                        <name>password</name>
                        <value>password_goes_here</value>
                   </parameter>
                   <parameter>
                        <name>driverClassName</name>
                        <value>jdbc_fully_qualified_class_name</value>
                   </parameter>
                   <parameter>
                        <name>factory</name>
                        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                   </parameter>
                   <parameter>
                        <name>url</name>
                        <value>jdbc_connect_url_database_vendor_specific</value>
                   </parameter>
                   <parameter>
                        <name>maxActive</name>
                        <value>8</value>
                   </parameter>
                   <parameter>
                        <name>maxIdle</name>
                        <value>8</value>
                   </parameter>
              </ResourceParams>
    - Saish
    "My karma ran over your dogma." - Anon

  • Modify existing XML file

    Ok I really need some help...What is the JAVA code that i need to add something to an existing XML file. Basically, I want to add a new tag at the end of another one. So I need to search the XML file for the end of one tag, and then add a new tag after that one. Please help.

    Sounds like you think it's simple. There is a set of XML tutorials here:
    http://java.sun.com/webservices/docs/1.0/tutorial/index.html
    You probably need the one titled "Document Object Model" but it may help to read some of the others too.

  • How to modify an existing xml file from java code.

    Hi
    I have worked on creating a new xml file from java code using xmlbeans.But if i try to modify an already existing file using java code I am unable to get errorfree xmlfile.
    For example if xml file(studlist.xml) is as below:
    <?xml version="1.0" encoding="UTF-8"?>
    <StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
         <Student>
              <Name>ram</Name>
              <Age>27</Age>
         </Student>
    <Student>
              <Name>sham</Name>
              <Age>26</Age>
         </Student>
    </StudentList>
    Now suppose i have set name to victor using student.setName,
    and set age to 20 using setAge from javacode,
    the new xml file is as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <StudentList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\kchaitanya\xmlprac1\abc\Studlist.xsd">
         <Student>
              <Name>ram</Name>
              <Age>27</Age>
         </Student>
    <Student>
              <Name>sham</Name>
              <Age>26</Age>
         </Student>
    </StudentList>
    <Student>
              <Name>victor</Name>
              <Age>20</Age>
         </Student>
    As observed this is not a valid xml file.But how can i modify without any errors?

    I know it's an old post, but I found this while doing a google search for something else, and don't like to leave it un-aswered
    Just in case anyone has a similar problem... In this case the new elements have been appended outside of the root element
    What you need to do is first get the root element and then append the new children to that, there are several ways of getting the root element, which depend on what you want to do with the elements you get back here's a simple (incomplete) way.
    // gets the root element of the specified file (code not shown)
    Element rootElement= new SAXReader().read(file).getRootElement();Then just append the new elements as below (this is non-generic code and would need to be modified for your situation)
    // write a new student element
    Element student = document.createElement("Student");  // creates the new student
    rootElement.appendChild(student); // ***appends it to the root element***
    Element name = document.createElement("Name"); // creates the name element
    name.appendChild(document.createTextNode("Fred")); // adds the name text to the name element
    student.appendChild(name); // appends the name to the student
    Element age= document.createElement("Age"); // creates the age element
    age.appendChild(document.createTextNode("26")); // adds the age text to the age element
    student.appendChild(age); // appends the name to the studentThen flush ya buffers or whatever and write the file
    Edited by: Dream-Scourge on Apr 23, 2008 11:10 AM

  • Add an extra line in the output xml file

    Dear All
    My scenarios is idoc to xml file.For the resultant xml file i have to append a line  <?Test Line?> after
    <?xml version="1.0" encoding="UTF-8" ?>  while passing it to  legacy system ?
    How generate such a xml file in xi?
    Any help would be appreciated
    Thanks and regards
    uday

    Dear All
    my requirement is to generate an xml file which looks similar to
    <?xml version="1.0" encoding="UTF-8"?>
    <?TestLine?>
    <test_mt>
    <field1>123</field1>
    <field2>234</field2>
    </test_mt>
    how to add <?TestLine?>  tag?
    Hi shabrasish and rajashekar
    i am new to java and xslt mapping can you guide me  or give me links which are similar to my requirement how to proceed with this kind of mapping
    thanks
    uday

  • How I can append new node in existing  XML file

    I've just begun learning DOM XML , so I'm currently at a very beginner level.
    I have an existing XML file that I would like to add an additional node to before saving it to another variable.
    how I can append new node in this file.
    now this code is overwrite new data over old data
    The code looks like this:
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.transform.Result;
    import javax.xml.transform.Source;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.TransformerFactoryConfigurationError;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Attr;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    public class VerbXMLWriter
        static String EVerb3;
        static String englishTranslate3;
        public void VerbXMLWriter(String EVerb, String englishTranslate )
             EVerb3 = EVerb;
             englishTranslate3=englishTranslate;
        File xmlFile = new File("VerbDB.xml");
        DocumentBuilderFactory factory =  DocumentBuilderFactory.newInstance();
        try
         DocumentBuilder builder = factory.newDocumentBuilder();
         Document document = builder.newDocument();
        Element root = document.createElement("Verb");
         document.appendChild(root);
         Element verb = document.createElement(EVerb3);
         verb.setAttribute("EnglishTranslate",englishTranslate3);
         root.appendChild(verb);
         Source xmlSource = new DOMSource( document );
         Result result = new StreamResult( new FileOutputStream(xmlFile) );
        TransformerFactory transformerFactory = TransformerFactory.newInstance();
        Transformer transformer =
        transformerFactory.newTransformer();
        transformer.setOutputProperty( "indent", "yes" );
         transformer.transform( xmlSource, result );
      catch(TransformerFactoryConfigurationError factoryError )
        factoryError.printStackTrace();
       catch (ParserConfigurationException pc)
           pc.printStackTrace();
       catch (IOException io)
          io.printStackTrace();
       catch(Exception excep )
           excep.printStackTrace();
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <Verb>
    <Play EnglishTranslate="playing" />
    </Verb>Edited by: itb402 on Mar 9, 2008 6:05 AM

    in your code you are already appending new nodes to the root node. so what exactly is your problem? The following steps are usually taken for appending a new node:
    1. Read the XML document
    2. Build a DOM tree
    3. Navigate to the node under which you want to insert the new node
    4. Create a new node.
    5. Insert the new node to the node selected in point #3.
    ~Debopam

Maybe you are looking for

  • Can I use my iPod with BOTH a Mac and PC???

    Might be an odd question and forgive me if it is an obvious answer. I just got a 30 gigger and connnected it up and charged it with my Mac mini at home last night. I have lots of music on my iTunes on my home Mac mini and I have some music on my work

  • What Is The Best Way To Connect Ipod To Stereo Reciever With High Quality?

    I recently purchased an 80 gig and am a newbie. I ripped all my music at around 280kbps to retain good audio quality when playing in my car and home theatre system. There are tons of accesories out there (docks, jacks, etc) which is the highest quali

  • Questions about submitting PDF form to server

    I need to add a submit button to an existing PDF form that will submit it to a PHP script on the server. I can find information on submitting as FDF, but what does the "submit as HTML" option do? What and how does it submit to the server? I added a b

  • Is there a plan for Apple to continue offering the external iSight camera?

    Hi All, I'm thrilled to be the new owner of a Mac Pro w/Cinema display, but I'm getting jealous of my partner on his MacBook Pro with built-in iSight camera, having all the fun with video iChats and video Skype calls. Since Apple has discontinued sal

  • No mail and connection to itunes

    I have 2 problems all happened around same time.  First a message that says the mail server is not responsing.  Verify account settings & all looks okay to me.  Secondly, when plugging ipad into PC itunes message is could not connect to the iopad bec