[Home] [By Thread] [By Date] [Recent Entries]

  • From: David Megginson <david@m...>
  • To: "Abhishek Srivastava" <abisheks@i...>
  • Date: 19 Dec 1999 07:34:58 -0500

"Abhishek Srivastava" <abisheks@i...> writes:

> Can someone explain that why does SAX have two call back functions
> one = for Tag Name (startElement ) and one for the tag Value (
> Characters ) = Instead, why not have one function that calls back
> the processing = application with a name value pair. ( for elements
> as well as attributes = )
> 
> This makes it easier to process the data as u get the name of the
> tag = and it's value in one shot.

Consider the following document:

  <div>
  <h1>Section</h1>

  <p>This is the <em>first</em> section.</p>
  </div>

Without the start/end callbacks, you wouldn't be able to figure out
the nesting of the document, or even the real order of the character
data:

  element("div", "\n\n\n\n")
  element("h1", "Section")
  element("p", "This is the  section.")
  element("em", "first")


All the best,


David

-- 
David Megginson                 david@m...
           http://www.megginson.com/

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@i... the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)



  • References:
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member