|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
AttributeList | Interface for an element's attribute specifications. |
DocumentHandler | Receive notification of general document events. |
DTDHandler | Receive notification of basic DTD-related events. |
EntityResolver | Basic interface for resolving entities. |
ErrorHandler | Basic interface for SAX error handlers. |
Locator | Interface for associating a SAX event with a document location. |
Parser | Basic interface for SAX (Simple API for XML) parsers. |
Class Summary | |
HandlerBase | Default base class for handlers. |
InputSource | A single input source for an XML entity. |
Exception Summary | |
SAXException | Encapsulate a general SAX error or warning. |
SAXParseException | Encapsulate an XML parse error or warning. |
SAX (Simple API to XML) is an event-driven parser API, which supports most of the widely available XML parsers. It does not provide all the information that an editor might want, such as comments, physical structure information (such as unexpanded entities), CDATA sections, or DTD support.
SAX promotes a modular design of XML systems, since it places no requirement on parsers to provide particular data structures (such W3C's DOM) representing XML documents. Since parsers plug in to the API using a driver style API, different parsers can be used for different application environments.
For more information on SAX, see the SAX page.
Then provide an implementation of the DocumentHandler, to receive your parsing events. (For example, you can build a DOM parse tree by using a com.sun.xml.tree.XmlDocumentBuilder instance as your document handler). This will need to be able to make copies of AttributeList data provided by the parser.
Finally, package your XML data as an InputSource (or get its URL) and call Parser.parse to send a stream of parse events to your document handler.
Applications can also provide an EntityResolver to participate in resolving the entities required by the XML document being parsed, arranging to use local or replicated copies. Some resolvers may have intelligence to access catalogs mapping XML public identifiers to URIs other than the system ID (perhaps stored in a local repository or a Java resource). They may also use all the available MIME type information, such as character encodings.
Some XML documents refer to unparsed entities or to notations in their attributes. When working with such documents, you will need to provide a DTDHandler object in order to be notified of the notations and unparsed entities which were defined in the document type definition (DTD).
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |