aspose file tools
The moose likes XML and Related Technologies and the fly likes order of event calling in SAX Parser Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "order of event calling in SAX Parser" Watch "order of event calling in SAX Parser" New topic
Author

order of event calling in SAX Parser

tushar jayawant
Greenhorn

Joined: Aug 20, 2003
Posts: 19
Hi to All

I'am parsing the following XML file using the SAX parser

<A>
<B>
<D>01243</D>
</B>
<C>
<D>020</D>
<E>Tushar1<E>
<D>0122</D>
<E>Tushar2</E>
</C>
</A>

Q1) Did the SAX specification confirm the order of calling the SAX event
i.e it call event in the following order a)startDoc b)startElement
c)characters d)endElement e)endDocument

Q2) Also did it navigate the XML file sequentially i.e first it call the event for <A> and then for <B> then for <D> and then for <C> and then again for <D> and then for <E>.......



Thankx in Advance
Tushar
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by tushar jayawant:
Q1) Did the SAX specification confirm the order of calling the SAX event
i.e it call event in the following order a)startDoc b)startElement
c)characters d)endElement e)endDocument
Yes, the order is strictly sequential, although the parser is allowed to split a piece of text into multiple characters() events.

Originally posted by tushar jayawant:
Q2) Also did it navigate the XML file sequentially i.e first it call the event for <A> and then for <B> then for <D> and then for <C> and then again for <D> and then for <E>...

Yes.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: order of event calling in SAX Parser
 
Similar Threads
Who can help me to solve the 3 questions
XPath problem
Questions on DOM/SAX test from XML Exam List
simple SAX parsing questions
Need Help Ranchers..EJB questions?