944,087 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 2265
  • Java RSS
Sep 21st, 2007
0

Xml Parsing using Sax

Expand Post »
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

}
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
sarath.koiloth is offline Offline
30 posts
since Sep 2006
Sep 21st, 2007
0

Re: Xml Parsing using Sax

Nevermind. Totally misread, I was assuming you were trying with regex.
Last edited by masijade; Sep 21st, 2007 at 8:19 am.
Moderator
Reputation Points: 1471
Solved Threads: 490
Industrious Poster
masijade is offline Offline
4,043 posts
since Feb 2006
Sep 21st, 2007
0

Re: Xml Parsing using Sax

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
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 839
Posting Genius
Ezzaral is offline Offline
6,761 posts
since May 2007
Sep 22nd, 2007
0

Re: Xml Parsing using Sax

Thanks You for ur valuable reply..
Reputation Points: 10
Solved Threads: 0
Light Poster
sarath.koiloth is offline Offline
30 posts
since Sep 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: can we write linlist program in java
Next Thread in Java Forum Timeline: 2D array help!





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC