Package com.icl.saxon.aelfred
Class SAXDriver
java.lang.Object
com.icl.saxon.aelfred.SAXDriver
- All Implemented Interfaces:
AttributeList
,Attributes
,Locator
,Parser
,XMLReader
public class SAXDriver
extends Object
implements Locator, Attributes, XMLReader, Parser, AttributeList
An enhanced SAX2 version of Microstar's Ælfred XML parser.
The enhancements primarily relate to significant improvements in
conformance to the XML specification, and SAX2 support. Performance
has been improved. However, the Ælfred proprietary APIs are
no longer public. See the package level documentation for more
information.
Name | Notes |
---|---|
(URL)/external-general-entities | Value is fixed at true |
(URL)/external-parameter-entities | Value is fixed at true |
(URL)/namespace-prefixes | Value defaults to false (but XML 1.0 names are always reported) |
(URL)/namespaces | Value defaults to true |
(URL)/string-interning | Value is fixed at true |
(URL)/validation | Value is fixed at false |
(URL)/declaration-handler | A declaration handler may be provided. Declaration of general entities is exposed, but not parameter entities; none of the entity names reported here will begin with "%". |
(URL)/lexical-handler | A lexical handler may be provided. Entity boundaries and comments are not exposed; only CDATA sections and the start/end of the DTD (the internal subset is not detectible). |
Note that the declaration handler doesn't suffice for showing all the logical structure of the DTD; it doesn't expose the name of the root element, or the values that are permitted in a NOTATIONS attribute. (The former is exposed as lexical data, and SAX2 beta doesn't expose the latter.)
Although support for several features and properties is "built in" to this parser, it support all others by storing the assigned values and returning them.
This parser currently implements the SAX1 Parser API, but it may not continue to do so in the future.
- Version:
- $Date: 2000/02/29 00:23:50 $
- Author:
- Written by David Megginson <dmeggins@microstar.com> (version 1.2a from Microstar), Updated by David Brownell <david-b@pacbell.net>
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
(package private) void
charData
(char[] ch, int start, int length) (package private) void
comment
(char[] ch, int start, int length) (package private) void
doctypeDecl
(String name, String publicId, String systemId) (package private) void
endCDATA()
(package private) void
(package private) void
(package private) void
endElement
(String elname) (package private) void
endExternalEntity
(String systemId) (package private) void
int
SAX Locator method (don't invoke on parser);SAX2: Returns the object used to report the logical content of an XML document.SAX2: Returns the object used to process declarations related to notations and unparsed entities.SAX2: Returns the object used when resolving external entities during parsing (both general and parameter entities).SAX2: Returns the object used to receive callbacks for XML errors of all levels (fatal, nonfatal, warning); this is never null;boolean
getFeature
(String featureId) SAX2: Tells the value of the specified feature flag.int
SAX2 Attributes method (don't invoke on parser);int
SAX2 Attributes method (don't invoke on parser);int
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);int
SAX Locator method (don't invoke on parser);getLocalName
(int index) SAX2 Attributes method (don't invoke on parser);getName
(int i) SAX1 AttributeList method (don't invoke on parser);getProperty
(String propertyId) SAX2: Returns the specified property.SAX Locator method (don't invoke on parser);getQName
(int i) SAX2 Attributes method (don't invoke on parser);SAX Locator method (don't invoke on parser);getType
(int i) SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);SAX2 Attributes method (don't invoke on parser);getURI
(int index) SAX2 Attributes method (don't invoke on parser);getValue
(int i) SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);SAX Attributes method (don't invoke on parser);(package private) void
ignorableWhitespace
(char[] ch, int start, int length) void
SAX1, SAX2: Preferred API to parse an XML document, using a system identifier (URI).void
parse
(InputSource source) SAX1, SAX2: Auxiliary API to parse an XML document, used mostly when no URI is available.(package private) void
processingInstruction
(String target, String data) (package private) Object
resolveEntity
(String publicId, String systemId) void
setContentHandler
(ContentHandler handler) SAX2: Assigns the object used to report the logical content of an XML document.void
setDocumentHandler
(DocumentHandler handler) Deprecated.SAX2 programs should use the XMLReader interface and a ContentHandler.void
setDTDHandler
(DTDHandler handler) SAX1, SAX2: Set the DTD handler for this parser.void
setEntityResolver
(EntityResolver resolver) SAX1, SAX2: Set the entity resolver for this parser.void
setErrorHandler
(ErrorHandler handler) SAX1, SAX2: Set the error handler for this parser.void
setFeature
(String featureId, boolean state) SAX2: Sets the state of feature flags in this parser.void
SAX1: Sets the locale used for diagnostics; currently, only locales using the English language are supported.void
setProperty
(String propertyId, Object property) SAX2: Assigns the specified property.(package private) void
(package private) void
(package private) void
startElement
(String elname) (package private) void
startExternalEntity
(String systemId)
-
Field Details
-
FEATURE
- See Also:
-
HANDLER
- See Also:
-
-
Constructor Details
-
SAXDriver
public SAXDriver()Constructs a SAX Parser.
-
-
Method Details
-
setLocale
SAX1: Sets the locale used for diagnostics; currently, only locales using the English language are supported.- Specified by:
setLocale
in interfaceParser
- Parameters:
locale
- The locale for which diagnostics will be generated- Throws:
SAXException
-
getEntityResolver
SAX2: Returns the object used when resolving external entities during parsing (both general and parameter entities).- Specified by:
getEntityResolver
in interfaceXMLReader
-
setEntityResolver
SAX1, SAX2: Set the entity resolver for this parser.- Specified by:
setEntityResolver
in interfaceParser
- Specified by:
setEntityResolver
in interfaceXMLReader
- Parameters:
handler
- The object to receive entity events.
-
getDTDHandler
SAX2: Returns the object used to process declarations related to notations and unparsed entities.- Specified by:
getDTDHandler
in interfaceXMLReader
-
setDTDHandler
SAX1, SAX2: Set the DTD handler for this parser.- Specified by:
setDTDHandler
in interfaceParser
- Specified by:
setDTDHandler
in interfaceXMLReader
- Parameters:
handler
- The object to receive DTD events.
-
setDocumentHandler
Deprecated.SAX2 programs should use the XMLReader interface and a ContentHandler.SAX1: Set the document handler for this parser. If a content handler was set, this document handler will supplant it. The parser is set to report all XML 1.0 names rather than to filter out "xmlns" attributes (the "namespace-prefixes" feature is set to true).- Specified by:
setDocumentHandler
in interfaceParser
- Parameters:
handler
- The object to receive document events.
-
getContentHandler
SAX2: Returns the object used to report the logical content of an XML document.- Specified by:
getContentHandler
in interfaceXMLReader
-
setContentHandler
SAX2: Assigns the object used to report the logical content of an XML document. If a document handler was set, this content handler will supplant it (but XML 1.0 style name reporting may remain enabled).- Specified by:
setContentHandler
in interfaceXMLReader
-
setErrorHandler
SAX1, SAX2: Set the error handler for this parser.- Specified by:
setErrorHandler
in interfaceParser
- Specified by:
setErrorHandler
in interfaceXMLReader
- Parameters:
handler
- The object to receive error events.
-
getErrorHandler
SAX2: Returns the object used to receive callbacks for XML errors of all levels (fatal, nonfatal, warning); this is never null;- Specified by:
getErrorHandler
in interfaceXMLReader
-
parse
SAX1, SAX2: Auxiliary API to parse an XML document, used mostly when no URI is available. If you want anything useful to happen, you should set at least one type of handler.- Specified by:
parse
in interfaceParser
- Specified by:
parse
in interfaceXMLReader
- Parameters:
source
- The XML input source. Don't set 'encoding' unless you know for a fact that it's correct.- Throws:
SAXException
- The handlers may throw any SAXException, and the parser normally throws SAXParseException objects.IOException
- IOExceptions are normally through through the parser if there are problems reading the source document.- See Also:
-
parse
SAX1, SAX2: Preferred API to parse an XML document, using a system identifier (URI).- Specified by:
parse
in interfaceParser
- Specified by:
parse
in interfaceXMLReader
- Throws:
SAXException
IOException
-
getFeature
SAX2: Tells the value of the specified feature flag.- Specified by:
getFeature
in interfaceXMLReader
- Throws:
SAXNotRecognizedException
- thrown if the feature flag is neither built in, nor yet assigned.
-
getProperty
SAX2: Returns the specified property.- Specified by:
getProperty
in interfaceXMLReader
- Throws:
SAXNotRecognizedException
- thrown if the property value is neither built in, nor yet stored.
-
setFeature
public void setFeature(String featureId, boolean state) throws SAXNotRecognizedException, SAXNotSupportedException SAX2: Sets the state of feature flags in this parser. Some built-in feature flags are mutable; all flags not built-in are motable.- Specified by:
setFeature
in interfaceXMLReader
- Throws:
SAXNotRecognizedException
SAXNotSupportedException
-
setProperty
public void setProperty(String propertyId, Object property) throws SAXNotRecognizedException, SAXNotSupportedException SAX2: Assigns the specified property. Like SAX1 handlers, these may be changed at any time.- Specified by:
setProperty
in interfaceXMLReader
- Throws:
SAXNotRecognizedException
SAXNotSupportedException
-
startDocument
- Throws:
SAXException
-
endDocument
- Throws:
SAXException
-
resolveEntity
- Throws:
SAXException
IOException
-
startExternalEntity
- Throws:
SAXException
-
endExternalEntity
- Throws:
SAXException
-
doctypeDecl
- Throws:
SAXException
-
endDoctype
- Throws:
SAXException
-
attribute
- Throws:
SAXException
-
startElement
- Throws:
SAXException
-
endElement
- Throws:
SAXException
-
startCDATA
- Throws:
SAXException
-
charData
- Throws:
SAXException
-
endCDATA
- Throws:
SAXException
-
ignorableWhitespace
- Throws:
SAXException
-
processingInstruction
- Throws:
SAXException
-
comment
- Throws:
SAXException
-
error
- Throws:
SAXException
-
getLength
public int getLength()SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);- Specified by:
getLength
in interfaceAttributeList
- Specified by:
getLength
in interfaceAttributes
-
getURI
SAX2 Attributes method (don't invoke on parser);- Specified by:
getURI
in interfaceAttributes
-
getLocalName
SAX2 Attributes method (don't invoke on parser);- Specified by:
getLocalName
in interfaceAttributes
-
getQName
SAX2 Attributes method (don't invoke on parser);- Specified by:
getQName
in interfaceAttributes
-
getName
SAX1 AttributeList method (don't invoke on parser);- Specified by:
getName
in interfaceAttributeList
-
getType
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);- Specified by:
getType
in interfaceAttributeList
- Specified by:
getType
in interfaceAttributes
-
getValue
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);- Specified by:
getValue
in interfaceAttributeList
- Specified by:
getValue
in interfaceAttributes
-
getIndex
SAX2 Attributes method (don't invoke on parser);- Specified by:
getIndex
in interfaceAttributes
-
getIndex
SAX2 Attributes method (don't invoke on parser);- Specified by:
getIndex
in interfaceAttributes
-
getType
SAX2 Attributes method (don't invoke on parser);- Specified by:
getType
in interfaceAttributes
-
getType
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);- Specified by:
getType
in interfaceAttributeList
- Specified by:
getType
in interfaceAttributes
-
getValue
SAX Attributes method (don't invoke on parser);- Specified by:
getValue
in interfaceAttributes
-
getValue
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);- Specified by:
getValue
in interfaceAttributeList
- Specified by:
getValue
in interfaceAttributes
-
getPublicId
SAX Locator method (don't invoke on parser);- Specified by:
getPublicId
in interfaceLocator
-
getSystemId
SAX Locator method (don't invoke on parser);- Specified by:
getSystemId
in interfaceLocator
-
getLineNumber
public int getLineNumber()SAX Locator method (don't invoke on parser);- Specified by:
getLineNumber
in interfaceLocator
-
getColumnNumber
public int getColumnNumber()SAX Locator method (don't invoke on parser);- Specified by:
getColumnNumber
in interfaceLocator
-