com.icl.saxon.aelfred

Class SAXDriver

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
Features ... URL prefix is http://xml.org/sax/features/
(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
Handler Properties ... URL prefix is http://xml.org/sax/properties/
(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: org.xml.sax.Parser

Field Summary
static StringFEATURE
static StringHANDLER
Constructor Summary
SAXDriver()
Constructs a SAX Parser.
Method Summary
voidattribute(String aname, String value, boolean isSpecified)
voidcharData(char[] ch, int start, int length)
voidcomment(char[] ch, int start, int length)
voiddoctypeDecl(String name, String publicId, String systemId)
voidendCDATA()
voidendDoctype()
voidendDocument()
voidendElement(String elname)
voidendExternalEntity(String systemId)
voiderror(String message, String url, int line, int column)
intgetColumnNumber()
SAX Locator method (don't invoke on parser);
ContentHandlergetContentHandler()
SAX2: Returns the object used to report the logical content of an XML document.
DTDHandlergetDTDHandler()
SAX2: Returns the object used to process declarations related to notations and unparsed entities.
EntityResolvergetEntityResolver()
SAX2: Returns the object used when resolving external entities during parsing (both general and parameter entities).
ErrorHandlergetErrorHandler()
SAX2: Returns the object used to receive callbacks for XML errors of all levels (fatal, nonfatal, warning); this is never null;
booleangetFeature(String featureId)
SAX2: Tells the value of the specified feature flag.
intgetIndex(String uri, String local)
SAX2 Attributes method (don't invoke on parser);
intgetIndex(String xmlName)
SAX2 Attributes method (don't invoke on parser);
intgetLength()
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);
intgetLineNumber()
SAX Locator method (don't invoke on parser);
StringgetLocalName(int index)
SAX2 Attributes method (don't invoke on parser);
StringgetName(int i)
SAX1 AttributeList method (don't invoke on parser);
ObjectgetProperty(String propertyId)
SAX2: Returns the specified property.
StringgetPublicId()
SAX Locator method (don't invoke on parser);
StringgetQName(int i)
SAX2 Attributes method (don't invoke on parser);
StringgetSystemId()
SAX Locator method (don't invoke on parser);
StringgetType(int i)
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);
StringgetType(String uri, String local)
SAX2 Attributes method (don't invoke on parser);
StringgetType(String xmlName)
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);
StringgetURI(int index)
SAX2 Attributes method (don't invoke on parser);
StringgetValue(int i)
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);
StringgetValue(String uri, String local)
SAX Attributes method (don't invoke on parser);
StringgetValue(String xmlName)
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);
voidignorableWhitespace(char[] ch, int start, int length)
voidparse(InputSource source)
SAX1, SAX2: Auxiliary API to parse an XML document, used mostly when no URI is available.
voidparse(String systemId)
SAX1, SAX2: Preferred API to parse an XML document, using a system identifier (URI).
voidprocessingInstruction(String target, String data)
ObjectresolveEntity(String publicId, String systemId)
voidsetContentHandler(ContentHandler handler)
SAX2: Assigns the object used to report the logical content of an XML document.
voidsetDocumentHandler(DocumentHandler handler)
SAX1: Set the document handler for this parser.
voidsetDTDHandler(DTDHandler handler)
SAX1, SAX2: Set the DTD handler for this parser.
voidsetEntityResolver(EntityResolver resolver)
SAX1, SAX2: Set the entity resolver for this parser.
voidsetErrorHandler(ErrorHandler handler)
SAX1, SAX2: Set the error handler for this parser.
voidsetFeature(String featureId, boolean state)
SAX2: Sets the state of feature flags in this parser.
voidsetLocale(Locale locale)
SAX1: Sets the locale used for diagnostics; currently, only locales using the English language are supported.
voidsetProperty(String propertyId, Object property)
SAX2: Assigns the specified property.
voidstartCDATA()
voidstartDocument()
voidstartElement(String elname)
voidstartExternalEntity(String systemId)

Field Detail

FEATURE

static final String FEATURE

HANDLER

static final String HANDLER

Constructor Detail

SAXDriver

public SAXDriver()
Constructs a SAX Parser.

Method Detail

attribute

void attribute(String aname, String value, boolean isSpecified)

charData

void charData(char[] ch, int start, int length)

comment

void comment(char[] ch, int start, int length)

doctypeDecl

void doctypeDecl(String name, String publicId, String systemId)

endCDATA

void endCDATA()

endDoctype

void endDoctype()

endDocument

void endDocument()

endElement

void endElement(String elname)

endExternalEntity

void endExternalEntity(String systemId)

error

void error(String message, String url, int line, int column)

getColumnNumber

public int getColumnNumber()
SAX Locator method (don't invoke on parser);

getContentHandler

public ContentHandler getContentHandler()
SAX2: Returns the object used to report the logical content of an XML document.

getDTDHandler

public DTDHandler getDTDHandler()
SAX2: Returns the object used to process declarations related to notations and unparsed entities.

getEntityResolver

public EntityResolver getEntityResolver()
SAX2: Returns the object used when resolving external entities during parsing (both general and parameter entities).

getErrorHandler

public ErrorHandler getErrorHandler()
SAX2: Returns the object used to receive callbacks for XML errors of all levels (fatal, nonfatal, warning); this is never null;

getFeature

public boolean getFeature(String featureId)
SAX2: Tells the value of the specified feature flag.

Throws: SAXNotRecognizedException thrown if the feature flag is neither built in, nor yet assigned.

getIndex

public int getIndex(String uri, String local)
SAX2 Attributes method (don't invoke on parser);

getIndex

public int getIndex(String xmlName)
SAX2 Attributes method (don't invoke on parser);

getLength

public int getLength()
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);

getLineNumber

public int getLineNumber()
SAX Locator method (don't invoke on parser);

getLocalName

public String getLocalName(int index)
SAX2 Attributes method (don't invoke on parser);

getName

public String getName(int i)
SAX1 AttributeList method (don't invoke on parser);

getProperty

public Object getProperty(String propertyId)
SAX2: Returns the specified property.

Throws: SAXNotRecognizedException thrown if the property value is neither built in, nor yet stored.

getPublicId

public String getPublicId()
SAX Locator method (don't invoke on parser);

getQName

public String getQName(int i)
SAX2 Attributes method (don't invoke on parser);

getSystemId

public String getSystemId()
SAX Locator method (don't invoke on parser);

getType

public String getType(int i)
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);

getType

public String getType(String uri, String local)
SAX2 Attributes method (don't invoke on parser);

getType

public String getType(String xmlName)
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);

getURI

public String getURI(int index)
SAX2 Attributes method (don't invoke on parser);

getValue

public String getValue(int i)
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);

getValue

public String getValue(String uri, String local)
SAX Attributes method (don't invoke on parser);

getValue

public String getValue(String xmlName)
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);

ignorableWhitespace

void ignorableWhitespace(char[] ch, int start, int length)

parse

public void parse(InputSource source)
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.

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: SAXDriver SAXDriver SAXDriver SAXDriver

parse

public void parse(String systemId)
SAX1, SAX2: Preferred API to parse an XML document, using a system identifier (URI).

processingInstruction

void processingInstruction(String target, String data)

resolveEntity

Object resolveEntity(String publicId, String systemId)

setContentHandler

public void setContentHandler(ContentHandler handler)
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).

setDocumentHandler

public void setDocumentHandler(DocumentHandler handler)

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

Parameters: handler The object to receive document events.

setDTDHandler

public void setDTDHandler(DTDHandler handler)
SAX1, SAX2: Set the DTD handler for this parser.

Parameters: handler The object to receive DTD events.

setEntityResolver

public void setEntityResolver(EntityResolver resolver)
SAX1, SAX2: Set the entity resolver for this parser.

Parameters: handler The object to receive entity events.

setErrorHandler

public void setErrorHandler(ErrorHandler handler)
SAX1, SAX2: Set the error handler for this parser.

Parameters: handler The object to receive error events.

setFeature

public void setFeature(String featureId, boolean state)
SAX2: Sets the state of feature flags in this parser. Some built-in feature flags are mutable; all flags not built-in are motable.

setLocale

public void setLocale(Locale locale)
SAX1: Sets the locale used for diagnostics; currently, only locales using the English language are supported.

Parameters: locale The locale for which diagnostics will be generated

setProperty

public void setProperty(String propertyId, Object property)
SAX2: Assigns the specified property. Like SAX1 handlers, these may be changed at any time.

startCDATA

void startCDATA()

startDocument

void startDocument()

startElement

void startElement(String elname)

startExternalEntity

void startExternalEntity(String systemId)