Question about parsing XML document with DOM in JAVA.

Ads
 

Question about parsing XML document with DOM in JAVA.

Hi, I need to parse a XML file witch has info about classes. So i have for each class to have its methods and for each method to get its parameters. I'm trying to do it with multiple for loops, one iside the other but it doesnt work. My XML is this below!

<SystemData>
  <SystemName>Erebus</SystemName>
  <Classes>
    <Class>
      <ClassName>Triangle</ClassName>
      <Methods>
    <Method>
      <MethodName>checkType</MethodName>
      <Parameters>
        <Parameter>
          <ParameterName> sideA </ParameterName>
          <Type> int </Type>
          <DomainMin> 1 </DomainMin>
          <DomainMax> 200 </DomainMax>
        </Parameter>
      </Parameters>
      <ReturnType> void </ReturnType>
    </Method>
      </Methods>
      <Methods>
    <Method>
      <MethodName>2imethodos</MethodName>
      <Parameters>
        <Parameter>
          <ParameterName> sideB </ParameterName>
          <Type> float </Type>
          <DomainMin> 1 </DomainMin>
          <DomainMax> 200 </DomainMax>
        </Parameter>
      </Parameters>
      <ReturnType> float </ReturnType>
    </Method>
      </Methods>
    </Class>
    <Class>
      <ClassName>Quad</ClassName>
      <Methods>
    <Method>
      <MethodName>checkShape</MethodName>
      <Parameters>
        <Parameter>
          <ParameterName> sides </ParameterName>
          <Type> int </Type>
          <DomainMin> 1 </DomainMin>
          <DomainMax> 200 </DomainMax>
        </Parameter>
      </Parameters>
      <ReturnType> void </ReturnType>
    </Method>
      </Methods>
    </Class>
  </Classes>
</SystemData>
View Answers

February 4, 2013 at 6:12 PM

hi friend,

Go through the following link hope this may helpful for you

  • [Getting Data from XML File (Document)]1

  • [JDOM example in java, How to read a xml file in java.]2


February 4, 2013 at 6:20 PM

Ads









Related Tutorials/Questions & Answers:
Question about parsing XML document with DOM in JAVA.
Question about parsing XML document with DOM in JAVA.  Hi, I need to parse a XML file witch has info about classes. So i have for each class to have... it with multiple for loops, one iside the other but it doesnt work. My XML is this below
xml document parsing
xml document parsing   Hi Guys, Xml document has been inserted into the database,how do i parse the xml document stored in database,so that xml document can be retrieved on to JSP file using jdbc/odbc connection. Please help me
Advertisements
java code to create xml document from DOM object
java code to create xml document from DOM object  Hey! After knowing the way we can create DOM objects and add elements to it-> then displaying it on the console ;is there a way I can output the same in xml document
Java XML Parsing Using DOM
Java XML Parsing Using SAX To Parse XML document using SAX parser method you... = saxParserFactory.newSAXParser(); // Parsing XML Document by calling parse method... = saxParserFactory.newSAXParser(); // Parsing XML Document by calling parse method of SAXParser
parsing xml file using java code
parsing xml file using java code  parsing a xml file using java code
XML DOM error - Java Beginners
XML DOM error  import org.w3c.dom.*; import javax.xml.parsers....("xml Document Contains " + nodes.getLength() + " elements."); } else... Document doc = factory.newDocumentBuilder().parse(xmlFile
dom to xml string
dom to xml string  Hi, I am writing a program in java that reads the xml file from a webservice. The Document object is returned in my program. I have save the dom document into xml file. How to convert dom to xml string
Question on java & XML
Question on java & XML  How do we convert the names of files and subfolders into an xml file... Suggestions needed...what are classes we need to use
Java Write To File Dom Document
Java Write To File Dom Document In this tutorial you will learn how to write to file dom document. Write to xml file you would be required to use the package... of org.w3c.dom package represents the whole HTML or XML document as a root
Document Object Model(DOM)
Document Object Model(DOM)       The Document Object Model (DOM) is a an standard object model that represents HTML or XML and related formats. Document Object Model is platform
xml parsing
xml parsing  my task is when i wll give java file to a program that program interpret that file separate each and every keywords and indentifiers... xml.. please anyone of you give some idea
Xml parsing
Xml parsing  Hi..i tried the above code but I unable to know where can i place the xml file
parsing xml file in jsp
parsing xml file in jsp  example that pars XML file in JSP
XML parsing to Mysql database
XML parsing to Mysql database  Can someone please post the code for parsing an XML file into Mysql database using SAX
XML DOM Tutorial
XML DOM Tutorial       W3C provides a standard called DOM (Document Object Model) for HTML & XML documents. DOM is also used as an interface for accessing and manipulating HTML & XML
Dom in java
Create XML using DOM import java.io.*; import org.w3c.dom.*; import...Dom in java  Exception in thread "main" org.w3c.dom.DOMException: INVALIDCHARACTERERR: An invalid or illegal XML character is specified
parsing xml with jquery
parsing xml with jquery  Please explain how to parse a xml file into jquery. Thanks
DOM Parser Example to Parse A DOM Document
DOM Parser Example to Parse A DOM Document In this tutorial, we will discuss about how to parse(retrieve data) DOM Document. The XML DOM views an XML document as a tree-structure. In this program, we read the XML file and print
parsing xml using sax
parsing xml using sax  how to get values if the root elements are same and their attributes are different
Processing XML with Java
available in Java for processing XML document. These are:  DOM: Document Object Model parsing interface SAX Interface: Simple API for XML...Processing XML using Java In this section we will see the API's available
XML Parsing from php web server in J2ME
XML Parsing from php web server in J2ME  Hello Team, You gave some tips for XML parsing in java, i need some additional tips for xml parsing from php web server in j2me... Thanks and Regards Alagu
Reading xml file using dom parser in java with out using getelementby tag name
Reading xml file using dom parser in java with out using getelementby tag name  Hi, How to read the xml file using java with dom parser, but without... found some thing in the below url : http://www.roseindia.net/answers/viewqa/Java
Java XML Parsing Using SAX
Java XML Parsing Using SAX To Parse XML document using SAX parser method you... = saxParserFactory.newSAXParser(); // Parsing XML Document by calling parse method... = saxParserFactory.newSAXParser(); // Parsing XML Document by calling parse method of SAXParser
problems in parsing the xml with the special characters
problems in parsing the xml with the special characters  Hi, I have a problem, in while parsing the xml with special characters apstrophe('). I am... parse this string in xml path. i am not able to fetch the adam's string in the xml
Java-XML Xerces/Jaxp
Java-XML Xerces/Jaxp  Im new to Java DOM development. I have doubt or I am bit unclear about fact of JAXP and Xerces. My question is why developer use xerces when jaxp does the job
Java-XML Xerces/Jaxp
Java-XML Xerces/Jaxp  Im new to Java DOM development. I have doubt or I am bit unclear about fact of JAXP and Xerces. My question is why developer use xerces when jaxp does the job
Example for getElementsByTagName() method in DOM Document.
parse the XML file using the parse() method. After parsing the document, we get...Example for getElementsByTagName() in DOM Document In this section ,we... of the child in the xml document. The method getElementsByTagName
creating document in XML - XML
creating document in XML  Create an XML document for catalogue...)); System.out.print("Enter number to add elements in your XML file: "); String... = documentBuilderFactory.newDocumentBuilder(); Document
xml question
xml question  > mplement award list of MCA 1 st year > as a XML document. The table must > have semester No, student√Ę‚?¨‚?Ęs Enrollment > No, TEE marks of all the theory > subjects, practical subjects and >
DOM Parser Tutorial
DOM Parser Tutorial Introduction Dom stands for Document Object Model. It is a Java API(Application Programming Interface ) for XML Parsing... interface for accessing creating and manipulating a XML document
Java dom from string
Java dom from string  Hi, How to create dom tree from string data? I am trying to search the example for java dom from string. Thanks   ...://www.roseindia.net"; String strData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n

Ads