| | |
Xml Parsing using Sax
![]() |
Hi friends,
please help me to solve this.
i need to read the elements from xml file.I am using sax api.
My xml looks like this :->
<test>
<test1>hello1</test1>
<test2>hello2</test2>
<test3>hello3</test3>
</test>
In my startElement(...){
elementName.equals("test"){
//I need to get all the elements inside the test element.ie test1,test2,test2.with out going to the endElement.Is there any method to solve thses problem
}
please help me to solve this.
i need to read the elements from xml file.I am using sax api.
My xml looks like this :->
<test>
<test1>hello1</test1>
<test2>hello2</test2>
<test3>hello3</test3>
</test>
In my startElement(...){
elementName.equals("test"){
//I need to get all the elements inside the test element.ie test1,test2,test2.with out going to the endElement.Is there any method to solve thses problem
}
Nevermind. Totally misread, I was assuming you were trying with regex.
Last edited by masijade; Sep 21st, 2007 at 8:19 am.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Unless you are parsing XML streams, you would find it simpler to use the DOM parser, which uses a Document model instead of the event-driven stream parsing of SAX.
Info on using both types of parsers is here:
http://java.sun.com/xml/tutorial_intro.html
Info on using both types of parsers is here:
http://java.sun.com/xml/tutorial_intro.html
![]() |
Similar Threads
- Searching XML documents with PHP (PHP)
- Need a PHP programmer with XML experience. (Web Development Job Offers)
- xml parsing from java (Java)
- What exactly is xml? (RSS, Web Services and SOAP)
- xml and p (Python)
- how xml is useful? (RSS, Web Services and SOAP)
- Java and XML (Java)
Other Threads in the Java Forum
- Previous Thread: can we write linlist program in java
- Next Thread: 2D array help!
| Thread Tools | Search this Thread |
add android api applet application applications array arrays automation bank binary bluetooth chat class clear client code codesnippet collections component converter database development dice digit eclipse equation error event formatingtextintooltipjava fractal functiontesting game givemetehcodez graphics gui health html hyper ide idea image infinite input int integer j2me java javame javaprojects jni jpanel julia linux list loop looping main map method methods mobile myregfun mysql netbeans newbie nonstatic openjavafx parameter pearl php print problem program programming project recursion repositories scanner scrollbar server set size sms sort sorting spamblocker sql sqlserver state storm string superclass swing swt text-file thread threads tree windows






