[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: SAX Validation

  • From: David Megginson <david@m...>
  • To: xml-dev@i...
  • Date: 30 Nov 1999 06:57:52 -0500

sax validation example
Mark Papiani <mp@e...> writes:

> I believe that one of the advantages of SAX parsers is that they report
> parsing events via callbacks and 
> can consume far less memory than DOM based parsers that build an in
> memory parse tree. 
> My question has to do with when validation errors are reported by SAX
> parsers. For example, if the closing tag of the root element is missing
> from an XML document, would a SAX parser only report that the document
> was invalid, after it had reported all the other valid parsing events
> for the rest of the document?

That really depends on the parser -- it has to report the error some
time before the endDocument() event, but when it does so depends on
the implementation.  If (for example) your parser builds an in-memory
tree first and then walks through it or if it buffers part or all of
the event stream, it might report the error immediately after the
startDocument() event.  Typically, though, the parser will deliver
events as it finds them, so you won't find out about the problem until
near the end.

By the way, the missing tag is a well-formedness error, so SAX parsers 
will use fatalError() rather than error() to report it.

All the best,


David Megginson                 david@m...

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...)


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.