XML using Java

Can anyone tell me how to parse n Save XML file using Java.

Dont double post! http://forum.java.sun.com/thread.jspa?threadID=5268589

Similar Messages

  • Read, Modify and Apply Report XML using Java Script

    Hi Guys,
    Is there any way that we can Pragmatically Read, Modify and Apply Report XML using Java Script or some other way.
    Thanks
    Kaushik
    Edited by: Kaushik K on Jun 20, 2012 8:36 PM

    Requirement ::
    Users should be able to add Column to the Report Dynamically at Runtime.
    (There are around 1000+ Users, Answers Approach is not acceptable)
    So we are planning to provide a Multi Select / Shuttle Box Option for Users to add Columns dynamically. (Only for Table View)
    What we planned to DO ::
    Create a Presentation Variable Prompt, Which reads the Metadata Table (Presentation Table.Column Name, populated using the Metadata Dictionary)
    And Create a report with One Column and the Column Fx like @{var_dynamic_columns}{'"Time"."Year","Time"."Month"'}
    With this, OBIEE is rewriting the Logical SQL Currently as "Select "Time"."Year","Time"."Month" from "A - Sample Sales" "
    But getting an error
    The number of columns returned in retrieving column metadata was invalid (expected: 1; received: 2)
    So we want to see, if we can rewrite the Advanced XML of the Report to have dynamic columns based on the Values from the Presentation Variable.
    Please help me if this is a viable solution or any other better solution.

  • Merge LiveCycle Form with XML using JAVA

    Hello.
    I am trying to find out how to merge non-interactive form with XML (using JAVA) so the users can see the final output form with the data filled in.
    What are my choices..?
    So far, I have created the interactive forms as template using LiveCycle 8 and wrote ASP.NET code to extract data and store it in SQL database when the user fill out and submit the form.
    It works great but another agency wants to access the form as well.
    They told us that they will create the XML themselves from the database, so they just need to combine the form with XML to display it (non-interactive form).
    They want to use JAVA but I am not sure how to do that...
    Any suggestion?

    Assuming that you start with XML in an org.w3c.dom.Document that stores the XML data. Before you can merge it into a form, you have to convert it to a com.adobe.idp.Document object. TO convert a org.w3c.dom.Document to a com.adobe.idp.Document object -- use the following Java code:
    private Document convertDataSource(org.w3c.dom.Document myDOM)
    byte[] mybytes = null;
    try
    //Create a Java Transformer object
    TransformerFactory transFact = TransformerFactory.newInstance();
    Transformer transForm = transFact.newTransformer();
    //Create a Java ByteArrayOutputStream object
    ByteArrayOutputStream myOutStream = new ByteArrayOutputStream();
    //Create a Java Source object
    javax.xml.transform.dom.DOMSource myInput = new DOMSource(myDOM);
    //Create a Java Result object
    javax.xml.transform.stream.StreamResult myOutput = new StreamResult(myOutStream);
    //Populate the Java ByteArrayOutputStream object
    transForm.transform(myInput,myOutput);
    // Get the size of the ByteArrayOutputStream buffer
    int myByteSize = myOutStream.size();
    //Allocate myByteSize to the byte array
    mybytes = new byte[myByteSize];
    //Copy the content to the byte array
    mybytes = myOutStream.toByteArray();
    catch (Exception e) {
    System.out.println("The following exception occurred: "+e.getMessage());
    //Create a com.adobe.idp.Document object and copy the
    //contents of the byte array
    Document myDocument = new Document(mybytes);
    return myDocument;
    THen you can merge myDocument into the Form using renderPDFFOrm:
    FormsResult formOut = formsClient.renderPDFForm(
    formName, //formQuery
    myDocument, //inDataDoc
    pdfFormRenderSpec, //PDFFormRenderSpec
    uriValues, //urlSpec
    fileAttachments //attachments
    Hope this helps!

  • Generating XML Using JAVA

    How to generate XML usng java without using following.
    import org.apache.xerces.dom.DocumentImpl;
    import org.apache.xml.serialize.OutputFormat;
    import org.apache.xml.serialize.XMLSerializer;
    XML to be generated is as follows.
    <?xml version="1.0" encoding="UTF-8"?>
    <Modi xmlns:xsi="Modi/Modi1">
    <docConfig>
    <className>PO</className>
    <classDesc>Purchase</classDesc>
    <create>Y</create>
    </docConfig>
    <indexConfig>
    <index sequence="1">
    <shortName>PODATE</shortName>
    <displayName>PO Date</displayName>
    <type>date</type>
    <length>10</length>
    </index>
    </indexConfig>
    </upload>

    Two answers.
    If you want to not use any of the XML-oriented classes, you can use a PrintWriter. Just code:
    PrintWriter pw = new PrinteWriter(whatever);
    pw.println( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" );
    etc.If you want to use XML-oriented classes, but just not these 3 (can't imagine why), then use
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    instead of XMLSerializer and OutputFormat, and
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    instead of the DocumentImpl
    Dave Patterson

  • Parsing XML using java DOM

    hi
    i am trying to parse a document and change a specific text value within an element althouh when i run the program it changes the nodes text however when i check the xml file it doesnt show the changes it remains the same the code that i am using is as follow iwould be greatful if any one culd help:
    //  ReplaceText.java
    // Reads intro.xml and replaces a text node.
    // Java core packages
    import java.io.*;
    // Java extension packages
    import javax.xml.parsers.*;
    import javax.xml.parsers.*;
    import javax.xml.transform.*;
    import javax.xml.transform.stream.*;
    import javax.xml.transform.dom.*;
    // third-party libraries
    import org.xml.sax.*;
    import org.w3c.dom.*;
    public class ReplaceText {
       private Document document;
       public ReplaceText()
          // parse document, find/replace element, output result
          try {
             // obtain default parser
             DocumentBuilderFactory factory =
                DocumentBuilderFactory.newInstance();
             // set parser as validating          
             factory.setValidating( true );
             // obtain object that builds Documents
             DocumentBuilder builder = factory.newDocumentBuilder();
             // set error handler for validation errors
             builder.setErrorHandler( new MyErrorHandler() );
      System.err.println( "reading" );
             // obtain document object from XML document
             File f = new File("D:/Documents and Settings/Administrator/Desktop/xml adv java bk/appC/intro.xml");
              System.err.println( "reading" );
             document = builder.parse(f);
    //document = builder.parse( new File( "intro.xml" ) );
    System.err.println( "reading document" );
             // retrieve the root node
             Node root = document.getDocumentElement();
             if ( root.getNodeType() == Node.ELEMENT_NODE ) {
                Element myMessageNode = ( Element ) root;
                NodeList messageNodes =
                   myMessageNode.getElementsByTagName( "message5" );
                if ( messageNodes.getLength() != 0 ) {
                   Node message = messageNodes.item( 0 );
                        System.out.println("iiiii");
                   // create text node
                   Text newText = document.createTextNode(
                      "New Changed Message!!" );
                   // get old text node
                   Text oldText =
                      ( Text ) message.getChildNodes().item( 0 ); 
                   // replace text
                   //message.removeChild(oldText);
                   message.replaceChild( newText, oldText );
             // output Document object
             // create DOMSource for source XML document
             Source xmlSource = new DOMSource( document );
             // create StreamResult for transformation result
             Result result = new StreamResult( System.out );
             // create TransformerFactory
             TransformerFactory transformerFactory =
                TransformerFactory.newInstance();
             // create Transformer for transformation
             Transformer transformer =
                transformerFactory.newTransformer();
             transformer.setOutputProperty( OutputKeys.INDENT, "yes" );
               transformer.setOutputProperty( OutputKeys.STANDALONE, "yes" );
             // transform and deliver content to client
             transformer.transform( xmlSource, result );
          // handle exception creating DocumentBuilder
          catch ( ParserConfigurationException parserException ) {
             parserException.printStackTrace();
          // handle exception parsing Document
          catch ( SAXException saxException ) {
             saxException.printStackTrace();        
          // handle exception reading/writing data
          catch ( IOException ioException ) {
             ioException.printStackTrace();
             System.exit( 1 );
          // handle exception creating TransformerFactory
          catch (
             TransformerFactoryConfigurationError factoryError ) {
             System.err.println( "Error while creating " +
                "TransformerFactory" );
             factoryError.printStackTrace();
          // handle exception transforming document
          catch ( TransformerException transformerError ) {
             System.err.println( "Error transforming document" );
             transformerError.printStackTrace();
       public static void main( String args[] )
          ReplaceText replace = new ReplaceText();   
    }the xml file that i am using is as follows:
    <?xml version = "1.0"?>
    <!-- Fig. 28.10 : intro.xml             -->
    <!-- Simple introduction to XML markup   -->
    <!DOCTYPE myMessage [
         <!ELEMENT myMessage (message, message5)>
         <!ELEMENT message (#PCDATA)>
         <!ELEMENT message5 (#PCDATA)>
    ]>
    <myMessage>
         <message>welcome to the xml shhhhhushu</message>
         <message5>welcome to the xml shhhhhushu</message5>
    </myMessage>i would be greatful if some one could please help.....

    See if the Text 'oldText' actually has any text within it. Sometimes in DOM parsing, you will get something like:
    Element
       Text (blank)
       Text (actual)
       Text (blank)Whereas you would expect to receive:
    Element
       Text (actual)See if that is the case. If yes, modify your logic to iterate through the child text nodes until one with actual text inside of it (getNodeValue()) is found.
    - Saish

  • Query resultset to xml using java and XML schema

    Hi,
    I query data using JDBC and I want to store it to an XML file which has a well defined XML schema. I searched a lot in the forum but did not find an answer. Please guide me to create this program.
    I have managed to use JDBC to get result set but I do not know how to export is to XML using XSD and Java.
    Please help.
    Regards,
    Ravi

    I have managed to use JDBC to get result set but I do
    not know how to export is to XML using XSD and Java.Export using XSD? Schemas are for validation.
    Iterate through the result set, and build up the XML stream by creating an entry for each row.
    Another way to do it is to load the ResultSet into a Java object and serialize that to XML using something like XStream.
    %

  • How to remove xmlns from xml using java

    Hi,
    <DLList xmlns="http://www.test.com/integration/feed" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Bagalkote</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Devengiri</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    </DLList>
    The above xml needs to be decomposed using xsu.I am facing a small problem because the xml has namespaces.
    How to remove the namespace using java to get the below xml
    Note:I am using XSLT for the transformation.The XSLT tag is not identifying the <DLList> tag with name space
    <DLList>
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Bagalkote</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Devengiri</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    </DLList>
    Please help.Let me know if any other information is required
    Thanks

    OK, here goes :
    For the example, I'll use a TB_DISTRICT table with the following structure :
    create table tb_district (
    sr_no number(3),
    district_name varchar2(100)
    );loaded with data from this page :
    http://india.gov.in/knowindia/districts/andhra1.php?stateid=KA
    and this XML document (one additional record compared to the one you posted) :
    <DLList xmlns="http://www.test.com/integration/feed" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Bagalkote</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Devengiri</ForecastName>
    <Humidity>89.9</Humidity>
    </Weather>
    <Weather>
    <StateName>Karnataka</StateName>
    <ForecastName>Dharwad</ForecastName>
    <Humidity>70.1</Humidity>
    </Weather>
    </DLList>In order to access the XML, I'll also use this Oracle directory object :
    create directory test_dir as 'D:\ORACLE\test';Final relational tables are :
    create table BUSINESS_TABLE
      STATE         VARCHAR2(30),
      DISTRICT_NAME VARCHAR2(30),
      HUMIDITY      NUMBER
    );and
    create table REJECT_TABLE
      STATE         VARCHAR2(30),
      DISTRICT_NAME VARCHAR2(30),
      HUMIDITY      NUMBER,
      ERROR_MESSAGE VARCHAR2(500)
    );With XMLTable function, we can easily break the XML into relational rows and columns ready to use for DML :
    SQL> alter session set nls_numeric_characters=". ";
    Session altered
    SQL>
    SQL> SELECT *
      2  FROM XMLTable(
      3    XMLNamespaces(default 'http://www.test.com/integration/feed'),
      4    '/DLList/Weather'
      5    passing xmltype(bfilename('TEST_DIR','test.xml'), nls_charset_id('CHAR_CS'))
      6    columns
      7      state         varchar2(30) path 'StateName'
      8    , district_name varchar2(30) path 'ForecastName'
      9    , humidity      number       path 'Humidity'
    10  )
    11  ;
    STATE                          DISTRICT_NAME                    HUMIDITY
    Karnataka                      Bagalkote                            89.9
    Karnataka                      Devengiri                            89.9
    Karnataka                      Dharwad                              70.1
    Then with a multitable insert, we load both the business table and the reject table (if the district name does not exist in TB_DISTRICT) :
    SQL> INSERT FIRST
      2    WHEN master_district_name IS NOT NULL
      3      THEN INTO business_table (state, district_name, humidity)
      4                VALUES (state, district_name, humidity)
      5    ELSE INTO reject_table (state, district_name, humidity, error_message)
      6              VALUES (state, district_name, humidity, 'Invalid district name')
      7  WITH xml_data AS (
      8    SELECT *
      9    FROM XMLTable(
    10      XMLNamespaces(default 'http://www.test.com/integration/feed'),
    11      '/DLList/Weather'
    12      passing xmltype(bfilename('TEST_DIR','test.xml'), nls_charset_id('CHAR_CS'))
    13      columns
    14        state         varchar2(30) path 'StateName'
    15      , district_name varchar2(30) path 'ForecastName'
    16      , humidity      number       path 'Humidity'
    17    )
    18  )
    19  SELECT x.*
    20       , t.district_name as master_district_name
    21  FROM xml_data x
    22       LEFT OUTER JOIN tb_district t ON t.district_name = x.district_name
    23  ;
    3 rows inserted
    SQL> select * from business_table;
    STATE                          DISTRICT_NAME                    HUMIDITY
    Karnataka                      Dharwad                              70.1
    SQL> select * from reject_table;
    STATE                          DISTRICT_NAME                    HUMIDITY ERROR_MESSAGE
    Karnataka                      Bagalkote                            89.9 Invalid district name
    Karnataka                      Devengiri                            89.9 Invalid district name

  • Generate XML using Java

    Hi all,
    How can I genrate a XML document using Java? What are the imports that I have to use? Also please tell me about JAXP and in what way it can be used to generate an XML
    Please Help me with examples..
    Thanks in advance

    You can generate xml with dom like this
    try {
         DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
         DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
         Document document = docBuilder.newDocument();
         Element element = document.createElement("<your_tag_name>"); // creares tag
         element.setAttribute("key", "value"); // adds an attribute to your tag
         Text text = document.createTextNode("some text"); // creates "some text node"
         element.appendChild(text); // adds text to our tag for ex. <your_tag_name>some text</your_tag_name>
         CDATASection cdata = document.createCDATASection("cdata text");
         element.appendChild(cdata); // appends it to element
         document.appendChild(element); // if you want to add this element *** root element
         // or
         root.appendChild(element); // where  root is another Element object
    } catch (ParserConfigurationException e) {
         e.printStackTrace();
    }

  • Edit the xml using java

    Hi friends,
    I am having one urgent requirement.I have two xml file name like test1.xml and test2.xml.
    I need to delete some contend in test1.xml file.
    And also i need to pass value from test2.xml to test1.xml by using java.
    i need code for that.
    I am very grateful to u if i am getting the answer.
    Thanks in Advance,

    Hi Fran,
    look into this Link
    JMS adapter ModuleProcessorException
    JMS--> DCJMSStringProperty2 and 1 ?

  • Reading XML using Java

    I want to read all <temp >nodes map them to some variable and create one more XML.
    I am stuck up in the first place itself where i need to read the data :( . I am getting null pointer exception, please find the code also.
    <?xml version="1.0" encoding="UTF-8"?>
    <ftpl id="47" name="XXXXXXXX xxx xxxxxxxx">
    <abc-cab name="Systems" id="43434">
    <abc-dr name="zzzzz" id="4545454">
    <temp key="Type">null</param>
    <temp key="Folder">/ZVZ/XXXXX - xyz</param>
    <temp key="Author">XYZ,ABC</param>
    <temp key="Comments">null</param>
    <temp key="Mailed_By">XYZ,ABC</param>
    <temp key="Subject">null</param>
    <temp key="Key_Words">null</param>
    <abc-page name="1" id="3524012">
    <file text="/asas/asasa/asa/asas/Oxxxxxx2276744.txt" count="1"/>
    </abc-page>
    </abc-dr>
    </abc-cab>
    </ftpl>
    try {
    File file = new File("source-file");
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document doc = db.parse(file);
    doc.getDocumentElement().normalize();
    System.out.println("Root element " + doc.getDocumentElement().getNodeName());
    NodeList nodeLst = doc.getElementsByTagName("abc-dr");
    for (int s = 0; s < nodeLst.getLength(); s++) {
    Node fstNode = nodeLst.item(s);
    if (fstNode.getNodeType() == Node.ELEMENT_NODE) {
    Element fstElmnt = (Element) fstNode;
    NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("abc-dr");
    Element fstNmElmnt = (Element) fstNmElmntLst.item(1);
    NodeList fstNm = fstNmElmnt.getChildNodes();
    System.out.println("First Node : " + ((Node) fstNm.item(1)).getNodeValue());
    NodeList lstNmElmntLst = fstElmnt.getElementsByTagName("Folder");
    Element lstNmElmnt = (Element) lstNmElmntLst.item(0);
    NodeList lstNm = lstNmElmnt.getChildNodes();
    } catch (Exception e) {
    e.printStackTrace();
    Please help.. let me know the code which read XML I have tried with all SAX/DOM i am getting same NUllPointerExcetion
    Message was edited by:
    JavaNewUser

    Hi
    Thanks patricknz
    pls find the XMl and the java code
    I have again modified the code .. but got the same result as below
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [temp: null]----------------------param =
    [abc-page: null]----------------------abc-page=
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Element;
    import java.lang.*;
    public class SampleDOM
        public static void main(String s[]){
            try{
                DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                Document document = docBuilder.parse("C:\\demo.xml");
                   NodeList nodeList = document.getElementsByTagName("abc-dr");
          for (int i = 0, length1 = nodeList.getLength(); i < length1; i++) {
            final Element rDoc = (Element)nodeList.item(i);
            final NodeList rDocC = rDoc.getChildNodes();
            for (int j = 0, length2 = rDocC.getLength(); j < length2; j++) {
              final Node child = rDocC.item(j);
            if (child.getNodeType() == Node.ELEMENT_NODE) {
                Element element = (Element)child;
                System.out.println(element.getChildNodes() + "----------------------" +
                                          new StringBuffer(element.getNodeName()).append(" = "));
            }catch(Exception e){
                e.printStackTrace();
    }XML FIle:-
    <?xml version="1.0" encoding="UTF-8"?>
    <ftpl id="47" name="XXXXXXXX xxx xxxxxxxx">
         <abc-cab name="Systems" id="43434">
              <abc-dr name="zzzzz" id="4545454">
                   <temp key="Type">null</param>
                   <temp key="Folder">/ZVZ/XXXXX - xyz</param>
                   <temp key="Author">XYZ,ABC</param>
                   <temp key="Comments">null</param>
                   <temp key="Mailed_By">XYZ,ABC</param>
                   <temp key="Subject">null</param>
                   <temp key="Key_Words">null</param>
                   <abc-page name="1" id="3524012">
                        <file text="/asas/asasa/asa/asas/Oxxxxxx2276744.txt" count="1"/>
                   </abc-page>
              </abc-dr>
         </abc-cab>
    </ftpl>Message was edited by:
    JavaNewUser
    Message was edited by:
    JavaNewUser

  • Problem in evaluating the xpath in xml using java.

    Hi ,
    I have written a method to evaluate the xpath, and will return the result as string 'true' or 'false' or 'anyValue as in the xpath'
    eg:
    <k>
    <g>1</g>
    <c>!</c>
    </k>
    <k>
    <g>2</g>
    <c>#</c>
    </k>
    <k>
    <c>$</c>
    </k>
    if the xpath is /k[g/text()='1']/c/text()='#' --- this code returns false
    similarly /k[g/text()='1']/c/text()='!' -- this returns true
    But in the flow of my project, we have removed the xml nodes which has no data. so , the last <k> tag is not having <g>. so , wat i expect is
    if the xpath is /k[g/text()='']/c/text()='$' should return true. but since, there is no <g> tag, it is returning false. But, by logic of my project, g is there, but removed bcz its null..
    Pls help me in this regard..
    Thanks,
    Sabarisri. N
    Edited by: Sabarisri N on Nov 11, 2011 4:33 PM
    Edited by: Sabarisri N on Nov 11, 2011 4:35 PM

    The criteria for the return true or false is not clear as all three instances are that specific. To accommodate these three instances, the xpath can be very restrictive in the look like this. For illustration, I put it in a xsl:if or xsl:when node testing use, supposing the context node be the parent of k node.
    <xsl:if test="k[(normalize-space(c)='!' and normalize-space(g)='1') or
        (normalize-space(c)='#' and normalize-space(g)='2') or
        (normalize-space(c)='$' and not(g))]">Since the conditions are that specific, it inevitably looks clumsy due to the need of enumerating case-by-case!

  • Compare Xmls Using Java Utility

    Hi,
    Is there any Java Utility or program available to compare two xml's ( of same xsd ) ...?
    Thanks.

    >
    Is there any Java Utility or program available to compare two xml's ( of same xsd ) ...?
    >
    You might be interested in the XMLUnit sourceforge project.
    http://xmlunit.sourceforge.net/
    >
    XMLUnit for Java provides two JUnit extension classes, XMLAssert and XMLTestCase, and a set of supporting classes (e.g. Diff, DetailedDiff,Transform,SimpleXpathEngine,Validator,NodeTest) that allow assertions to be made about:
    The differences between two pieces of XML
    >
    You don't mention Oracle but it has built-in support for this
    See the XMLDIFF function in the SQL Language Doc
    http://docs.oracle.com/cd/B28359_01/server.111/b28286/functions229.htm

  • How to add DTD syntax line into XML using java code

    Hi,
    I am building xml file with java, usiing document.createElement()
    and document.appendChild(element),
    like that
    now i need to add dtd file path and synatx in the top of the xml file,
    how can i do it through java code
    any body could help me
    i appreciate your help.
    thanks
    Durga

    Hi Suneetha,
    Thanks for your reply..
    Now i am getting docType in xml file but not in the format of what i want
    please look at my code
    i need
    <!DOCTYPE myRootElement SYSTEM "myXMLDTD.dtd" >
    but i am getting
    <!DOCTYPE myRootElement PUBLIC "" "myXMLDTD.dtd">
    There is change i need to get the SYSTEM in place of PUBLIC and i need to get rid of "" code between dtd and PUBLIC
    for this i am doing in my code as
    DocumentType theDocType = new DocumentImpl().createDocumentType ("SYSTEM","","myXMLDTD.dtd");
    Document theDoc = new DocumentImpl(theDocType);
    i dn't know what is the wrong ? i dn't know what are the parameters at what place to pass if you know any thing just let me know
    thanks in advance
    and i apperciate you help.
    Durga

  • READING XML FROM JAVA

    I am developing web services based GIS, I have XML file which was generated from Geoserver. I dont know how to link Java with XML and query XML from Java. I need help pls.
    PAI

    there are apis to parse xml using java,
    http://www.cafeconleche.org/books/xmljava/chapters/ch09s06.html
    try this link..
    regards
    Shanu

  • Displaying XML using table

    hello i want to display xml using java script whose structure is as follows<MSCIT>
    <efbankmaster>
    <pkBankId><![CDATA[1]]></pkBankId>
    <vcBankName><![CDATA[Bank of Baroda]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[2]]></pkBankId>
    <vcBankName><![CDATA[Bank of India]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[3]]></pkBankId>
    <vcBankName><![CDATA[Punjab National Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[4]]></pkBankId>
    <vcBankName><![CDATA[Canara Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[5]]></pkBankId>
    <vcBankName><![CDATA[Central Bank of India]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[6]]></pkBankId>
    <vcBankName><![CDATA[Union Bank of India]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[7]]></pkBankId>
    <vcBankName><![CDATA[Indian Overseas Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[8]]></pkBankId>
    <vcBankName><![CDATA[Indian Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[9]]></pkBankId>
    <vcBankName><![CDATA[Syndicate Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[10]]></pkBankId>
    <vcBankName><![CDATA[UCO Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[11]]></pkBankId>
    <vcBankName><![CDATA[Allahabad Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[12]]></pkBankId>
    <vcBankName><![CDATA[United Bank of India]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[13]]></pkBankId>
    <vcBankName><![CDATA[Oriental Bank of Commerce]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[14]]></pkBankId>
    <vcBankName><![CDATA[Dena Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[15]]></pkBankId>
    <vcBankName><![CDATA[Vijaya Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[16]]></pkBankId>
    <vcBankName><![CDATA[Bank of Maharashtra]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[17]]></pkBankId>
    <vcBankName><![CDATA[Andhra Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[18]]></pkBankId>
    <vcBankName><![CDATA[Punjab & Sind Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[19]]></pkBankId>
    <vcBankName><![CDATA[Corporation Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[20]]></pkBankId>
    <vcBankName><![CDATA[State Bank of India]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[21]]></pkBankId>
    <vcBankName><![CDATA[ICICI Bank ]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[22]]></pkBankId>
    <vcBankName><![CDATA[HDFC Bank]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[23]]></pkBankId>
    <vcBankName><![CDATA[State Bank of Hyderabad]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[24]]></pkBankId>
    <vcBankName><![CDATA[State Bank of Bikaner and Jaipur]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[25]]></pkBankId>
    <vcBankName><![CDATA[State Bank of Indore]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[26]]></pkBankId>
    <vcBankName><![CDATA[State Bank of Mysore]]></vcBankName>
    </efbankmaster>
    <efbankmaster>
    <pkBankId><![CDATA[27]]></pkBankId>
    <vcBankName><![CDATA[State Bank of Patiala]]></vcBankName>
    </efbankmaster>
    i wrote java script for traversing this xml and printing text node in it,which is as follows<html>
    <head>
    <title>display xml</title>
    <script language="JavaScript">
    var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    function loadXML(xmlFile) {
    xmlDoc.async="false";
    xmlDoc.onreadystatechange=verify;
    xmlDoc.load(xmlFile);
    function verify() {
    if(xmlDoc.readyState!=4)
    return false;
    function traverse(tree) {
    if(tree.hasChildNodes()) {
    document.write('<ul><li>');
    document.write('<b>'+tree.tagName+' : </b>');
    var nodes=tree.childNodes.length;
    for(var i=0; i<tree.childNodes.length; i++)
    traverse(tree.childNodes(i));
    document.write('</li></ul>');
    else
    document.write(tree.text);
    function initTraverse(file) {
    loadXML(file);
    var doc=xmlDoc.documentElement;
    traverse(doc);
    </script>
    </head>
    <body>
    <input type="button" value="displayXML" onclick="initTraverse('E:\\Zipfiles\\EF\\Centers\\regfiles\\xml\\23210174')"></input>
    </body>
    </html>
    i want that corresponding to each tag a column is created  and it's value is placed in next row,just like a DBMS table having column and it's value just below it..,,any idea is welcome
    regards
    puneet vyas                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    This site is about the Java Programming Language, not javascript. Locking this thread.

Maybe you are looking for

  • Text from text module is not appearing in smartform output

    Hi Experts, We are using text modules in one of our smartform to print the sender text . The name of this text module is being dynamically determined during the execution and is coming correctly but still the the text inside the text module is not ap

  • Where can I find the archive feature on iPad, it's not with my email and I want to try to sinc my contacts from Verizon.

    I'm new to to iPad,and trying to get my Verizon mailbox folders into mail, it says once I turn on archive &log into my vz mail it will sinc the folders into mail but I can't find the archive option to turn it on?...help!

  • How to convert string to date

    HI Everyone, i am trying to convert a date which is in string format to a date format...but i am having this error javax.servlet.ServletException: Unparseable date: "2004-05-03" Can anyone help? Here is a piece of code :- SimpleDateFormat formatter=

  • Manually adding an attachment to FND tables

    I know that there have been a few posts that outline how to handle adding an attachment to FND tables but I have an additional question. I have an trigger on each of the following four tables that captures all data when uploading an attachment when c

  • How to determine a change to a Sales Order Header Text?

    Hi All, Is it possible to compare text entered on a Sales Order Header with what was stored previously? I know I can use READ_TEXT to retrieve previously stored text but how do I compare with what was entered at VA02? I'm at VA02, I'm selectin 1 line