OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: SAX Question

[ Lists Home | Date Index | Thread Index ]
  • From: David Megginson <david@megginson.com>
  • To: "Abhishek Srivastava" <abisheks@india.hp.com>
  • Date: 19 Dec 1999 07:34:58 -0500

"Abhishek Srivastava" <abisheks@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@megginson.com
           http://www.megginson.com/

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@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@ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)



  • References:
    • SAX Question
      • From: "Abhishek Srivastava" <abisheks@india.hp.com>



 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS