Updation on XML

Hi friends,
               Is it possible to update the XML dynamically. Usually I would create an XML  statically before processing it during runtime. Actually my doubt is that can I make updation in the same XML during run runtime as doing with database.
Thanks and Regards,
                    Sreelash.S.

Sreelash wrote:
I think with flash alone, there is no possibility for back end operation. My aim is to provide back end operations with flash only or with flash media server.
flash alone can't create or change a file on the server.  do you need to create or change a server file?

Similar Messages

  • Error trying to update web.xml

    I'm trying to update  web.xml via these instructions:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d0eb8120-b66c-2910-5795-894f384fc054
    The upload fails, and I see this excetpion in the log:
    Caused by: java.rmi.RemoteException: Error occurred during single file update of
           application sap.com/irj. Reason: Updating the security information in the
           deployment descriptors is not allowed in this operation.; nested exception is:
         com.sap.engine.services.servlets_jsp.server.exceptions.WebDeploymentException:
           Updating the security information in the deployment descriptors is not
           allowed in this operation.
    Ideas?  I'm signing in as Administrator, so why would the operation not be allowed?
    This is a 7.0 system, and the instructions are for a nw2004 system.  We've successfully uploaded the web.xml file before, so I'm thinking that something has changed in 7.0 that's preventing the upload.

    This page of the documentation indicates that the technique is the correct case:
    http://help.sap.com/saphelp_nw70/helpdata/en/6e/8590f1d6d349c9adc34c6a8085189b/frameset.htm
    So, one of two things has happened:
    1. The documentation is in error, or
    2. A bug has been introduced.
    I'm hoping it's #2....

  • Updating a XML document with a processing instruction

    Greetings Guru's
    I have a fully functional XML database solution for our new system. The only thing left is for me to update a xml document in the database with a processing instruction to find the style sheet (JAXB strips it out when the XML must go back into the database).
    I can update complete nodes and node elements in the xml document using updateXML in a regular update statement, but I do not know how to add the following processing instruction to my documents.
    <?xml-stylesheet type="text/xsl" href="/RASWEB/JIT_REPORT.xslt"?>
    [pre]
    Thanks in advance
    Derrick                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    SQL> var xmltext varchar2(4000)
    SQL> --
    SQL> begin
      2    :xmlText := '<Hello>World</Hello>';
      3  end;
      4  /
    PL/SQL procedure successfully completed.
    SQL> drop table t
      2  /
    drop table t
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> create table t of xmltype
      2  /
    Table created.
    SQL> set long 10000
    SQL> --
    SQL> insert into t values (xmltype(:xmltext))
      2  /
    1 row created.
    SQL> select *
      2    from t
      3  /
    SYS_NC_ROWINFO$
    <Hello>World</Hello>
    SQL> update t set object_value = updateXML
      2                              (
      3                                object_value,
      4                                '/',
      5                                xmlconcat
      6                                (
      7                                  xmlpi("xml-stylesheet",'type="text/xsl" href="/RASWEB/JIT_REPORT.xslt"'),
      8                                  object_value
      9                                )
    10                              )
    11  /
    1 row updated.
    SQL> select * from t
      2  /
    SYS_NC_ROWINFO$
    <?xml-stylesheet type="text/xsl" href="/RASWEB/JIT_REPORT.xslt"?>
    <Hello>World</Hello>
    SQL>

  • Need to update the xml clob-pls pls help!

    my xml is stored as blob, i can view,do string manipulation and churn out data etc...but now i have a request where i need to find some particualr node and modify its value.
    here is what i m doing now which works.
    select compressor2.blob_decompress2(xml_data) into l_blob
    from tablename where id=2008890;
    clob_data := utl2.blob2clob(l_blob);
    parser := xmlparser.newParser;
    xmlparser.parseClob(parser, clob_data);
    doc := xmlparser.getDocument(parser);
    nl := xmldom.getElementsByTagName(doc, '*');
    len := xmldom.getLength(nl);
    dbms_output.put_line('Length : ' || len);
    tag_name := 'Node Verson : ' || xmldom.getVersion(doc)|| '<br>';
    for counter in 0..len-1
    loop
    tag_name := '';
    node := xmldom.item(nl, counter);
    parent_node := xmldom.getParentNode(node);
    child_node := xmldom.getfirstchild(node);
    tag_name := 'Parent Name : ' || xmldom.getNodeName(parent_node) || '<br>';
    tag_name := tag_name || 'Node Name : ' || xmldom.getNodeName(node) || '<br>';
    IF xmldom.getNodeType(child_node) = xmldom.TEXT_NODE THEN
    tag_name := tag_name || 'Node Value : ' || xmldom.getNodeValue(child_node)|| '<br>';
    ELSE
    tag_name := tag_name || 'Node Value : Node has child.No Node value.' || '<br>';
    END IF;
    tag_name := tag_name || 'Node Type : '||xmldom.getNodeType(child_node) || '<br>';
    ele_name := xmldom.getDocumentElement(doc);
    child_nl := xmldom.getElementsByTagName(ele_name,'*');
    IF xmldom.isNull(doc) THEN
    htp.p('Document is null');
    ELSE
    htp.p(tag_name);
    END IF;
    end loop;
    b_blob := utl.clob2blob(tag_name);
    select compressor2.blob_compress2(b_blob) into b_blob2 from dual;
    insert into xupdate values (2008890,b_blob2);
    i still need to know how to update the xml clob... i want to know how to find the particular node and then modify the clob with the new value. rest i can update the table.
    pls pls help..on this.

    my oracle version.
    10.2.0.1.0
    i want to update here..
    <?xml version="1.0" encoding="utf-8"?>
    <TestData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
         <Status>CompletedNormally</TestCompletionStatus>
         <ComputerName>DUILT10</ComputerName>
         <StartTime>2008-03-19T15:12:23</StartTime>
    ---Some more noded----
    <Parameters>
              <RangeMeasured>
                   <Name>PDissBol-5[C]</Name>
                   <Min>1.22</Min>
                   <Max>1.36</Max>
                   <Units>W</Units>
              </RangeMeasured>
              <TextMeasured>
                   <Name>ComputerName</Name>
                   <Value>DUILT10</Value>
              </TextMeasured>
              <RangeMeasured>
                   <Name>TrackError25[C]To-5[C]</Name>
                   <Min>0.031</Min>
                   <Max>0.041</Max>
                   <Units>dB</Units>
              </RangeMeasured>
              <RangeMeasured>
                   <Name>Power-5[C]</Name>
                   <Min>1.988</Min>
                   <Max>1.061</Max>
                   <Units>dBm</Units>
              </RangeMeasured>
    ---some more noded---
    </Parameters>
    </TestData>
    the file is huge.
    what i need to chang==>
    I 1st need to find this PDissBol-5[C] within the <Parameters> Node and then change its <Min> and <Max>
    and then update the table.
    pls pls suggest.

  • Database updation using XML and stored Procedure?

    Hello,
    I want to perform updation in multiple tables using XML files.Please suggest can I do updation using xml and stored procedure.
    If yes then which is more efficient and takes less time.
    1.Updation using xml files only
    2.Updation using xml files with stored procedure.
    3.Stored procedure alone.
    If direct xml and stored procedure communication is possible.then please write how.
    Thanks in advance for any help.

    Here's a sample. The next code drop of the XSQL Servlet will make the easy-to-do from within XSQL Pages:
    package package1;
    import org.w3c.dom.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.xml.sql.query.OracleXMLQuery;
    public class Class1 extends Object {
    public static void main( String[] arg ) throws Exception {
    Connection conn = getConnection();
    CallableStatement ocs = conn.prepareCall("begin ? := App.HotItems('PAUL'); end;");
    ocs.registerOutParameter(1,OracleTypes.CURSOR);
    ocs.execute();
    ResultSet rs = ((OracleCallableStatement)ocs).getCursor(1);
    OracleXMLQuery oxq = new OracleXMLQuery(conn,rs);
    System.out.println(oxq.getXMLString());
    oxq.close();
    rs.close();
    ocs.close();
    conn.close();
    public static Connection getConnection() throws Exception {
    String username = "scott";
    String password = "tiger";
    String dburl = "jdbc:oracle:thin:@localhost:1521:xml";
    String driverClass = "oracle.jdbc.driver.OracleDriver";
    Driver d = (Driver)Class.forName(driverClass).newInstance();
    return DriverManager.getConnection(dburl,username,password);
    null

  • How to updating plugin.xml when it changed in 12C?

    After Importing the Plug-in Archive and Deploying it on Management Service with 12C, I need to make a change with plugin.xml in Plug-in Archive. Here it's the change,
    --- Old one:
    <PluginAttributes Type="MP" ReleaseStatus="Test"/>
    --- Change to:
    <PluginAttributes Type="MP" DisplayName="MySQL Database" Category="Databases"/>
    So I un-deployed Plug-in from Management Serbice, and used command "emcli import_update" to update the brand new OPAR file successfully, and the deployed again. But it seems the new plugin.xml didn't work at all, neither from UI nor the plugin.xml located under Management Server folder. I am sure it should work cause after I changed the Target Type and etc. in all related files to made a new plug-in, it works well.
    So how to updating plugin.xml when it changed in 12C? (It seems there is no option with MRS.)
    Thanks in advance!
    Best wishes,
    Satine

    Hey Caroy,
    Thank you for your help.
    It seems there is no entrance within page "Setup->Extensibility->Self Update" to delete a plugin. Would you please tell me more specific position?
    I will upgrade the version of plugin and try again to see if it works.
    Thanks,
    Satine

  • How to update an XML file?

    hi,
    I am having an xml file like this.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE map [ <!ELEMENT map (entry*) >
    <!ELEMENT entry EMPTY >
    <!ATTLIST entry key ID #REQUIRED
    value CDATA "mydefault"> ]>
    <map>
    <entry key="key1" value="xxx"/>
    <entry key="key2" value="yyy"/>
    </map>
    I have written a DOMparsing program to parse this XML file. And the program is this,
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.parsers.FactoryConfigurationError;
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.transform.TransformerException;
    import org.xml.sax.SAXException;
    import org.xml.sax.SAXParseException;
    import java.io.File;
    import java.io.IOException;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NamedNodeMap;
    import org.w3c.dom.DOMException;
    import org.w3c.dom.Attr;
    import org.w3c.dom.NodeList;
    public class DomExample
    public static void main(String args[])
    // Obtain an XML document; this method is implemented in
    Document doc = parseXmlFile("sample1.xml", true);
    //Getting elements by Tag name
    NodeList nodeList= doc.getElementsByTagName("entry");
    // Obtain an element
    Element element = (Element)(nodeList.item(0));
    element.removeAttribute("value");
    element.setAttribute("value", "Manivannan");
    try
    TransformerFactory tFactory =TransformerFactory.newInstance();
    StreamSource stylesource = new StreamSource();
    Transformer transformer = tFactory.newTransformer(stylesource);
    DOMSource source = new DOMSource(doc);
    //File f1 = new File("Sample3.xml");
    StreamResult result = new StreamResult(System.out);
    transformer.transform(source, result);
         catch(TransformerException te)
         te.printStackTrace();
    public static Document parseXmlFile(String filename, boolean validating) {
    try {
    // Create a builder factory
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setValidating(validating);
    DocumentBuilder builder = factory.newDocumentBuilder();
    // Create the builder and parse the file
    Document doc = builder.parse(new File(filename));
    return doc;
    } catch (SAXException e) {
    // A parsing error occurred; the xml input is not valid
    } catch (ParserConfigurationException e) {
    } catch (IOException e) {
    return null;
    Now what i am trying to do is replace value xxx in my xml with "Manivannan" and yyy with "gopalan"..But what i am getting during running this program is i am getting MalformedURL exception..Also will this program be able to update my xml with new values.If not possible pls let me know the method to update my xml file.
    Thanks for your reply in advance.

    Replace
    StreamSource stylesource=new StreamSource();
    Transformer transformer=tfactory.newTransformer(stylesource);with
    Transformer transformer=tfactory.newTransformer();

  • Update the xml file using jsp

    Hi all,
    I want to update the xml file node values.I tried this but the node values is not updating ie not changing
    This is my code
    This my jsp page
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ page import="javax.xml.parsers.DocumentBuilderFactory,
    javax.xml.parsers.DocumentBuilder,org.w3c.dom.*,org.w3c.dom.Element"
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <%try
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse("http://localhost:8084/XmlApplication1/sss.xml");
    String name = "Banglore";
    NodeList nlst = doc.getElementsByTagName("name");
    Node node= nlst.item(0).getFirstChild();
    // Node nod2=node.getFirstChild();
    node.setNodeValue(name);
    catch(Exception e)
    out.println(e) ;
    %>
    This is my xml file
    <?xml version="1.0" encoding="UTF-8"?>
    <place>
    <name>chennai</name>
    </place>
    plz do some help to update this value

    i tried this but the data is just transfereinf in xml file but its not over writet he content in xml file.
    i send my code
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@ page import="javax.xml.parsers.DocumentBuilderFactory,
    javax.xml.parsers.DocumentBuilder,org.w3c.dom.*,org.w3c.dom.Element"
    %>
    <%@ page import=" org.w3c.dom.*,java.io.File,java.io.IOException,java.io.OutputStream,java.io.FileOutputStream,
    javax.xml.parsers.*,
    javax.xml.transform.*,
    javax.xml.transform.dom.*,
    javax.xml.transform.stream.*
    " %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <%
    String bgcolor = request.getParameter("bgcolor");
    String heading = request.getParameter("heading");
    String fontsize = request.getParameter("fontsize");
    String fontcolor = request.getParameter("fontcolor");
    String str1="";
    String str2="";
    try{
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse("http://localhost:8084/XmlApplication1/input.xml");
    Document tempDocument = doc;
    DOMSource source = new DOMSource(tempDocument);
    NodeList n11 = doc.getElementsByTagName("bgcolor");
    Node n1= n11.item(0).getFirstChild();
    str1 = n1.getNodeValue();
    out.println(str1);
    n1.setNodeValue(bgcolor);
    out.println("After change");
    str2 = n1.getNodeValue();
    out.println(str2);
    NodeList n12 = doc.getElementsByTagName("heading");
    Node n2= n12.item(0).getFirstChild();
    String str11 = n2.getNodeValue();
    out.println(str11);
    n2.setNodeValue(heading);
    out.println("After change");
    String str22 = n2.getNodeValue();
    out.println(str22);
    NodeList n13 = doc.getElementsByTagName("fontsize");
    Node n3= n13.item(0).getFirstChild();
    String str13 = n3.getNodeValue();
    out.println(str13);
    n3.setNodeValue(fontsize);
    out.println("After change");
    String str23 = n3.getNodeValue();
    out.println(str23);
    NodeList n14 = doc.getElementsByTagName("fontcolor");
    Node n4= n14.item(0).getFirstChild();
    String str14 = n4.getNodeValue();
    out.println(str14);
    n4.setNodeValue(fontcolor);
    out.println("After change");
    String str24 = n4.getNodeValue();
    out.println(str24);
    // File file = new File("D:/Leela/XmlApplication1/build/web/input.xml");
    OutputStream outStream = new FileOutputStream("D:/Leela/XmlApplication1/build/web/input.xml");
    StreamResult result = new StreamResult(outStream);
    Transformer xformer = TransformerFactory.newInstance().newTransformer();
    System.out.println("Wrote to new file");
    xformer.transform(source, result);
    outStream.flush();
    outStream.close();
    catch(Exception e)
    out.println();
    %>
    </body>
    </html>
    the xml file shows the same content its not ovwr writing
    <?xml version="1.0" encoding="UTF-8"?>
    <input>
    <bgcolor>DarkCyan</bgcolor>
    <heading>4</heading>
    <fontsize>12</fontsize>
    <fontcolor>DodgerBlue</fontcolor>
    </input>

  • Update of XML syndication map when XSD is changed

    All,
    So we recently upgraded to MDM 7.1 SP 06 and found a new feature which we were waiting for quiet some time. Thought i'll share with the community as well.
    Update of XML syndication map when XSD is changed in Console
    In earlier SP's of MDM, if we had to update an XML syndication map, we had to upload the new XSD in Console, go to syndicator and basically re-create the whole map. there was no way for syndicator to preserve the old mapping.
    Well with this new feature, the old mapping is preserved, we only need to re-map the new fields.
    The process is as below:
    1. Upload the new XSD in Console.
    2. Go to syndicator and open the syndication map which you want to update(File->Open).
    3. Click File -> Update XML Schema. (this is the new option)
    4. It will give a pop-up, select the new schema you have uploaded in console and hit OK.
    5. You will get a prompt saying that syndication map is being changed, hit OK.
    6. Now you will see the new XSD in syndicator, the older fields are still mapped, you only need to map the new fields.
    It a nice feature which will definitely save lot of time. Thanks SAP
    Regards
    Aamir

    If this post answered your question or helped, please mark it as such.
    This works.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
      <mx:Script>
        <![CDATA[
          import mx.events.DataGridEvent;
          import mx.collections.ArrayCollection;
          [Bindable] private var ac:ArrayCollection = new ArrayCollection([
            {bgColor: "0xFF0000", num: 100, name: "Test1"},
            {bgColor: "0xFF0000", num: 200, name: "Test2"},
            {bgColor: "0xFF0000", num: 300, name: "Test3"},
          private function changeBK(evt:DataGridEvent):void{
            var row:uint = evt.rowIndex;
            var data:Object = ac.getItemAt(row);
            data.bgColor = "0x00FF00";
        ]]>
      </mx:Script>
      <mx:DataGrid id="dg" dataProvider="{ac}" itemEditEnd="changeBK(event);"
        editable="true">
        <mx:columns>
          <mx:DataGridColumn dataField="num">
            <mx:itemRenderer>
              <mx:Component>
                <mx:TextArea backgroundColor="{data.bgColor}" text="{data.num}"/>
              </mx:Component>
            </mx:itemRenderer>
          </mx:DataGridColumn>
          <mx:DataGridColumn dataField="name"/>
        </mx:columns>   
      </mx:DataGrid>
    </mx:Application>

  • Is there update to XML Export Extension?

    I just updated ADDT to version 1.0.1 for my Dreamweaver CS3   when it got down installing and I restarted Dreamweaver I got a popup message saying that there is a new update to XML Export Extension and to go to Adobe's website to check it out.
    I can't find any mention of this extension on the site even though I have it.  Was there an actual update to this extension or was it just bogus message?
    I have DW CS3, ADDT 1.0.1 and XML Export Extension 1.00
    If there was an update can someone point me to where I can download it?
    Thank you.

    I believe it's a bogus message even if there is one this is the best query to xml script.

  • Updating an XML file inside the executable JAR.

    Hello all!
    I would like to askk how can i update an XML file that is packaged inside my jar file?
    For intstance:
    I have a Java Application in NetBeans
    Inside a package i have constructed a custom .xml file.
    I can read from this file using
    .....getClass().getResourceAsStream("/.../file.xml")and after that using XPath for querying and works fine.
    I want to update an entry in my xml file so the jar contains now the newly updated file.
    Thanks everyone who spends hit time to read this. Hope someone can help me.

    Please don't cross-post:
    http://forums.sun.com/thread.jspa?threadID=5342194

  • Updating an XML file inside the Jar executable

    Hello all!
    I would like to ask how can i update an XML file that is packaged inside my jar file?
    For intstance:
    I have a Java Application in NetBeans
    Inside a package i have constructed a custom .xml file.
    I can read from this file using
    .....getClass().getResourceAsStream("/.../file.xml")and after that using XPath for querying and works fine.
    I want to update an entry in my xml file so the jar contains now the newly updated file.
    Thanks everyone who spends his time to read this. Hope someone can help me.

    Even if it were possible, it would be a bad idea. A jar file is something you deploy. It can be really hard to manage ongoing maintenance if the thing you deploy changes after you've deployed it.
    Just create a file, in an appropriate place given the user's OS, to hold data that changes after the jar has been deployed. Your application will still be in a single jar; it's just that the application will happen to create additional content outside the jar.

  • Author Name Not Updated After XML Fix

    I've searched high and low for a solution before posting this thread.
    I'm on my 9th episode of my podcast. I've been on itunes since the first episode and my feed is through feedburner. I've always wondered why the Author name in the Itunes store is "Unknown" and wanted to get it fixed. A couple weeks ago I figured out how to update the XML information in feedburner and updated the Author name and pinged feedburner. Since then, Author name is STILL listed as Unknown.
    Can anyone tell me what else I have to do for this to be updated?? It's just baffling to me that itunes is updating fine with my new episodes when I ping but is not picking up the Author info.
    Please help!
    By the way, the podcast is called the Decibel Geek podcast.
    Thanks in advance!

    Please when you have a query always post the feed URL to save detective work: for the record yours is at
    http://dbgeekshow.libsyn.com/rss
    The relevant tag in the feed does not contain a name;
    <itunes:author><![CDATA[]]></itunes:author>
    Feedburner is not involved in this - iTunes is using the Libsyn feed and it's there that you need to make the amendment.

  • How to Update and XML file

    Hi,
    I'm reading an XML file using SAX api, now based on some calculations, i want to add a new Element inside the same XML file.
    <?xml version="1.0" encoding="UTF-8"?>
    <types>
    <type super = "City">
    <t>Faro</t>
    <t>Porto</t>
    <t>Helsinki</t>
    </type> 
    </types>Now in the above XML snippet, i want to add an new sub element <t> Islamabad </t>, inside types.
    Following is the point in the code where i'm stuck:
    for (int typeID = 0; typeID < typeList.size(); typeID++) {
                        Element type = (Element) typeList.get(typeID);
                        String superTypeStr = type.getAttributeValue("super").toString();
                        if (superTypeStr.equalsIgnoreCase(comboValue)) {
                             Element t = new Element("t");
                             t.addContent(typeValue);
                             //NOW HOW TO ADD THIS <t>, inside a matched type element (in this case "city"), and write it into the xml file
                             break;
    typeList is a List object, which i get using : typeList = types.getChildren("type");Hope i have explained the problem clearly, writing an XML fime from scratch is easy. but in my case i want to update an existing xml file with a new element entry.
    The XML file should need to be updated like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <types>
    <type super = "City">
    <t>Faro</t>
    <t>Porto</t>
    <t>Helsinki</t>
    <t>Islamabad</t>
    </type> 
    </types>--
    Regards Suleman

    hey mate, i remember when i had a similar issue before. I ended up using parsing the document using DOM instead of SAX. The reason being that i wanted to update the XML file and if i parsed the document using DOM i had a handle on the document object so i could subsequently update it. But the drawback is that the entire xml structure is parsed into memory, as opposed to SAX which im sure you know is event driven and memory friendly. I would use SAX for the simple process of parsing the xml file to either examine, or print out the content or both.Perhaps consider DOM?

  • Changing /updating an xml file using JAXP(DOM)

    Hello,
    i am fairly new to xml and am using it in my degree project.I am able to retrieve and read data from a fairly large xml file using JAXP(DOM) and/or XMLBeans.I am having difficulties in updating the xml document. Any updation i believe is ito be saved into a new xml document,but dont know how to proceed with it. Any help would be appreciated.
    Following is a snippet of my code using JAXP. Here i am able to retrieve data from the source file.
    File document=new File("C:\\tester.xml");
    try {
    DocumentBuilderFactory factory
    = DocumentBuilderFactory.newInstance();
    DocumentBuilder parserr = factory.newDocumentBuilder();
    Document doc=parserr.parse(document);
    System.out.println(document + " is well-formed.");
    NodeList n2=doc.getElementsByTagName("Top");
    NodeList n3=doc.getElementsByTagName("Base");
    int x=n2.getLength();
    System.out.println("There are " x "players");
    for(int g=0;g<=x;g++)
    System.out.println("Top is" + n2.item(g).getFirstChild().getNodeValue()+" Base is" +n3.item(g).getFirstChild().getNodeValue());
    --------------------------------------------------------------------------------

    Following is my updation code to the dom tree:
    NodeList list=doc.getElementsByTagName("Information");
    for(int i=0; i<list.getLength();i++){
    Node thissampnode=list.item(i);
    Node thisNameNode=thissampnode.getFirstChild();
    if(thisNameNode==null) continue;
    if(thisNameNode.getFirstChild()==null)continue;
    // if(thisNameNode.getFirstChild() !(instanceof org.w3c.dom.Text) continue;
    String data=thisNameNode.getFirstChild().getNodeValue();
    if (! data.equals("0.59")) continue;
    Node newsampNode = doc.createElement("Samp");
    Node newsampTopNode = doc.createElement("Top");
    Text tnNode = doc.createTextNode("0.50");
    newsampTopNode.appendChild(tnNode);
    Element newsampRef = doc.createElement("Ref");
    Text tsr = doc.createTextNode("0");
    newsampRef.appendChild(tsr);
    Element newsampType = doc.createElement("Type");
    Text tt = doc.createTextNode("z");
    newsampType.appendChild(tt);
    Element newsampbase = doc.createElement("Base");
    Text sb = doc.createTextNode("0.55");
    newsampbase.appendChild(sb);
    newsampNode.appendChild(newsampTopNode);
    newsampNode.appendChild(newsampRef);
    newsampNode.appendChild(newsampType);
    newsampNode.appendChild(newsampbase);
    rootNode.insertBefore(newsampNode, thissampnode);
    Here i dont see any changes to the original xml source file.

Maybe you are looking for

  • Multiple applications not showing up in "Application Support" folder. Help?

    In my "Library" folder there is an "Application Support" folder. And I had alot of applications in there. All of the information and things of ALL my applications was saved in there. After I updated to OSX Lion there are only a FEW applications liste

  • Could threads of a same process run on different CPU in the same time ?

    Hello, probably stupid question..., but I would like to understand if several threads inside a same process can run in the same time on separate CPU. If the response is positive, how can I bind a thread on differant CPU using C API ? Also what is the

  • Using DVI, distance between the Mini and the Monitor?

    I'm in the process of setting up an Intel MacMini to be used in conjunction with an LCD TV (with a DVI input) to be used for a continuously-running Keynote presentation in a public place. I am currently looking to get a 37" LCD Television (the larges

  • Migration assistant issue

    ok, so I've just tried to do a migration from my ibookG4 and the migration got hung up at 38 minutes remaining. So I did a hard reboot by holding down the power button as the finder locked up after I quit Migration Assistant. Now after reboot my hard

  • Is 256 gb flash storage enough on the retina display Mbp?

    I am going to college and can't decide between the baseline 15 inch MacBook pro with 500 gb hard drive and the baseline retina display. While the speed and slender design of the retina display are certainly appealing, I am concerned that the 256 gb o