Validating the xml
SAX provides a mechanism for reading data from an XML document that is an alternative to that provided by the Document Object Model (DOM).Where the DOM operates on the document as a whole, i.e.Many tasks, such as indexing, conversion to other formats, very simple formatting, and the like, can be done that way.Other tasks, such as sorting, rearranging sections, getting from a link to its target, looking up information on one element to help process a later one, and the like, require accessing the document structure in complex orders and will be much faster with DOM than with multiple SAX passes.Thus, the minimum memory required for a SAX parser is proportional to the maximum depth of the XML file (i.e., of the XML tree) and the maximum data involved in a single XML event (such as the name and attributes of a single start-tag, or the content of a processing instruction, etc.). A DOM parser, in contrast, has to build a tree representation of the entire document in memory to begin with, thus using memory that increases with the entire document length.This takes considerable time and space for large documents (memory allocation and data-structure construction take time).Due to the nature of DOM, streamed reading from disk requires techniques such as lazy evaluation, caches, virtual memory, persistent data structures, or other techniques (one such technique is disclosed in ).
Tools category section below includes annotated links to Web authoring / HTML editors, reviews, and other resources, along with links to HTML reference charts, cleanup and conversion tools, automated HTML tools, and HTML validators. Note that some tools include HTML editors will generate the HTML markup for you, such as Dreamweaver and Front Page above, and so will publishing programs and content management systems (CMS).Additionally, some kinds of XML processing simply require having access to the entire document.XSLT and XPath, for example, need to be able to access any node at any time in the parsed XML tree.building the full AST of XML document for convenience of the user, SAX parsers operate on each piece of the XML document sequentially, issuing parsing events while making single pass through the input stream.A SAX parser only needs to report each parsing event as it happens, and normally discards almost all of that information once reported (it does, however, keep some things, for example a list of all elements that have not been closed yet, in order to catch later errors such as end-tags in the wrong order).For another, some implementations provide "Init" and "Fin" callbacks for the very start and end of parsing; others don't.The exact names for given event types also vary slightly between implementations.Editors and browsers likewise need to be able to display, modify, and perhaps re-validate at any time.While a SAX parser may well be used to construct such a tree initially, SAX provides no help for such processing as a whole.SAX parsing is unidirectional; previously parsed data cannot be re-read without starting the parsing operation again.There are many SAX-like implementations in existence.