SAX Question

David Megginson david at
Sun Dec 19 12:40:33 GMT 1999

"Abhishek Srivastava" <abisheks at> 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:


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

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

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

All the best,


David Megginson                 david at

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list