| | |
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 |
Tag cloud for Java
affinetransform android api apple applet application arc arguments array arrays automation binary bluetooth businessintelligence chat class classes client code component csv database desktop draw ebook eclipse equation error event exception fractal game givemetehcodez graphics gui html ide image input integer intersect iphone j2me java java.xls javaexcel javaprojects jmf jni jpanel julia linked linux list loop mac main map method methods mobile netbeans newbie number online open-source oracle parameter print problem program programming project properties recursion reference replaysolutions reporting rotatetext scanner screen scrollbar server set size sms socket sort sql string superclass swing template test threads time tree windows working xstream






