| | |
Xml Parsing using Sax
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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 |
addball addressbook android api append applet application apps array arrays automation binary bluetooth businessintelligence button card chat class classes client code collision component crashcourse css csv database eclipse ee error exception fractal free game gis givemetehcodez graphics gui html ide image input integer integration j2me java javaarraylist javadoc javafx javaprojects jni jpanel julia jvm linux list loan loop machine map method methods migrate mobile netbeans newbie output phone physics print problem program programming project radio recursion reporting robot scanner screen se server service set size sms socket software sort sql string swing textfield threads transfer tree trolltech ubuntu utility windows






