SAX Question
David Megginson
david at megginson.com
Sun Dec 19 12:40:33 GMT 1999
"Abhishek Srivastava" <abisheks at india.hp.com> 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 at megginson.com
http://www.megginson.com/
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list