Xml Parsing using Sax

Reply

Join Date: Sep 2006
Posts: 30
Reputation: sarath.koiloth is an unknown quantity at this point 
Solved Threads: 0
sarath.koiloth's Avatar
sarath.koiloth sarath.koiloth is offline Offline
Light Poster

Xml Parsing using Sax

 
0
  #1
Sep 21st, 2007
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

}
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,386
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: Xml Parsing using Sax

 
0
  #2
Sep 21st, 2007
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
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,454
Reputation: Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of Ezzaral has much to be proud of 
Solved Threads: 510
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: Xml Parsing using Sax

 
0
  #3
Sep 21st, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 30
Reputation: sarath.koiloth is an unknown quantity at this point 
Solved Threads: 0
sarath.koiloth's Avatar
sarath.koiloth sarath.koiloth is offline Offline
Light Poster

Re: Xml Parsing using Sax

 
0
  #4
Sep 22nd, 2007
Thanks You for ur valuable reply..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC