⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
gnu.xml.aelfred2

Class SAXDriver

java.lang.Object
|
+--gnu.xml.aelfred2.SAXDriver

All Implemented Interfaces:
AttributeList, Attributes2, Locator, Parser, XMLReader


public final class SAXDriver
extends java.lang.Object
implements Locator, Attributes2, 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. See the package level documentation for more information.
NameNotes
Features ... URL prefix is http://xml.org/sax/features/
(URL)/external-general-entitiesValue defaults to true
(URL)/external-parameter-entitiesValue defaults to true
(URL)/is-standalone(PRELIMINARY) Returns true iff the document's parsing has started (some non-error event after startDocument() was reported) and the document's standalone flag is set.
(URL)/namespace-prefixesValue defaults to false (but XML 1.0 names are always reported)
(URL)/lexical-handler/parameter-entitiesValue is fixed at true
(URL)/namespacesValue defaults to true
(URL)/resolve-dtd-uris(PRELIMINARY) Value defaults to true
(URL)/string-interningValue is fixed at true
(URL)/use-attributes2(PRELIMINARY) Value is fixed at true
(URL)/use-entity-resolver2(PRELIMINARY) Value defaults to true
(URL)/validationValue is fixed at false
Handler Properties ... URL prefix is http://xml.org/sax/properties/
(URL)/declaration-handlerA declaration handler may be provided.
(URL)/lexical-handlerA lexical handler may be provided.

This parser currently implements the SAX1 Parser API, but it may not continue to do so in the future.

Authors:
Written by David Megginson (version 1.2a from Microstar)
Updated by David Brownell <dbrownell@users.sourceforge.net>
See Also:
org.xml.sax.Parser

Constructor Summary

SAXDriver()

Constructs a SAX Parser.

Method Summary

int

getColumnNumber()

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

ContentHandler

getContentHandler()

SAX2: Returns the object used to report the logical content of an XML document.

DTDHandler

getDTDHandler()

SAX2: Returns the object used to process declarations related to notations and unparsed entities.

EntityResolver

getEntityResolver()

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

ErrorHandler

getErrorHandler()

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

boolean

getFeature(java.lang.String featureId)

SAX2: Tells the value of the specified feature flag.

int

getIndex(java.lang.String uri, java.lang.String local)

SAX2 Attributes method (don't invoke on parser);

int

getIndex(java.lang.String xmlName)

SAX2 Attributes method (don't invoke on parser);

int

getLength()

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

int

getLineNumber()

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

java.lang.String

getLocalName(int index)

SAX2 Attributes method (don't invoke on parser);

java.lang.String

getName(int i)

SAX1 AttributeList method (don't invoke on parser);

java.lang.Object

getProperty(java.lang.String propertyId)

SAX2: Returns the specified property.

java.lang.String

getPublicId()

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

java.lang.String

getQName(int i)

SAX2 Attributes method (don't invoke on parser);

java.lang.String

getSystemId()

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

java.lang.String

getType(int i)

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

java.lang.String

getType(java.lang.String uri, java.lang.String local)

SAX2 Attributes method (don't invoke on parser);

java.lang.String

getType(java.lang.String xmlName)

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

java.lang.String

getURI(int index)

SAX2 Attributes method (don't invoke on parser);

java.lang.String

getValue(int i)

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

java.lang.String

getValue(java.lang.String uri, java.lang.String local)

SAX Attributes method (don't invoke on parser);

java.lang.String

getValue(java.lang.String xmlName)

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

boolean

isDeclared(int index)

boolean

isDeclared(java.lang.String qName)

boolean

isDeclared(java.lang.String uri, java.lang.String localName)

boolean

isSpecified(int index)

SAX-ext Attributes2 method (don't invoke on parser);

boolean

isSpecified(java.lang.String uri, java.lang.String local)

SAX-ext Attributes2 method (don't invoke on parser);

boolean

isSpecified(java.lang.String xmlName)

SAX-ext Attributes2 method (don't invoke on parser);

void

parse(InputSource source)

SAX1, SAX2: Auxiliary API to parse an XML document, used mostly when no URI is available.

void

parse(java.lang.String systemId)

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

void

setContentHandler(ContentHandler handler)

SAX2: Assigns the object used to report the logical content of an XML document.

void

setDocumentHandler(DocumentHandler handler)

SAX1: Set the document handler for this parser.

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(java.lang.String featureId, boolean value)

SAX2: Sets the state of feature flags in this parser.

void

setLocale(java.util.Locale locale)

SAX1: Sets the locale used for diagnostics; currently, only locales using the English language are supported.

void

setProperty(java.lang.String propertyId, java.lang.Object value)

SAX2: Assigns the specified property.

Constructor Details

SAXDriver

public SAXDriver()

Constructs a SAX Parser.

Method Details

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(java.lang.String featureId)

SAX2: Tells the value of the specified feature flag.

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

getIndex

public int getIndex(java.lang.String uri, java.lang.String local)

SAX2 Attributes method (don't invoke on parser);

Parameters:
uri
local

getIndex

public int getIndex(java.lang.String xmlName)

SAX2 Attributes method (don't invoke on parser);

Parameters:
xmlName

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

Parameters:
index

getName

public String getName(int i)

SAX1 AttributeList method (don't invoke on parser);

Parameters:
i

getProperty

public Object getProperty(java.lang.String propertyId)

SAX2: Returns the specified property.

Parameters:
propertyId
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);

Parameters:
i

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

Parameters:
i

getType

public String getType(java.lang.String uri, java.lang.String local)

SAX2 Attributes method (don't invoke on parser);

Parameters:
uri
local

getType

public String getType(java.lang.String xmlName)

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

Parameters:
xmlName

getURI

public String getURI(int index)

SAX2 Attributes method (don't invoke on parser);

Parameters:
index

getValue

public String getValue(int i)

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

Parameters:
i

getValue

public String getValue(java.lang.String uri, java.lang.String local)

SAX Attributes method (don't invoke on parser);

Parameters:
uri
local

getValue

public String getValue(java.lang.String xmlName)

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

Parameters:
xmlName

isDeclared

public boolean isDeclared(int index)

Parameters:
index
Returns:
false unless the attribute was declared in the DTD.
Throws:
java.lang.ArrayIndexOutOfBoundsException - When the supplied index does not identify an attribute.

isDeclared

public boolean isDeclared(java.lang.String uri, java.lang.String localName)

Parameters:
uri
localName
Returns:
false unless the attribute was declared in the DTD.
Throws:
java.lang.IllegalArgumentException - When the supplied names do not identify an attribute.

isDeclared

public boolean isDeclared(java.lang.String qName)

Parameters:
qName
Returns:
false unless the attribute was declared in the DTD.
Throws:
java.lang.IllegalArgumentException - When the supplied names do not identify an attribute.

isSpecified

public boolean isSpecified(int index)

SAX-ext Attributes2 method (don't invoke on parser);

Parameters:
index

isSpecified

public boolean isSpecified(java.lang.String uri, java.lang.String local)

SAX-ext Attributes2 method (don't invoke on parser);

Parameters:
uri
local

isSpecified

public boolean isSpecified(java.lang.String xmlName)

SAX-ext Attributes2 method (don't invoke on parser);

Parameters:
xmlName

parse

public void parse(java.lang.String systemId)

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

Parameters:
systemId

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.
Throws:
SAXException - The handlers may throw any SAXException, and the parser normally throws SAXParseException objects.
java.io.IOException - IOExceptions are normally through through the parser if there are problems reading the source document.
See Also:
setEntityResolver
setDTDHandler
setContentHandler
setErrorHandler

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

Parameters:
handler

setDocumentHandler

public void setDocumentHandler(DocumentHandler handler)

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:
resolver - 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(java.lang.String featureId, boolean value)

SAX2: Sets the state of feature flags in this parser. Some built-in feature flags are mutable.

Parameters:
featureId
value

setLocale

public void setLocale(java.util.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(java.lang.String propertyId, java.lang.Object value)

SAX2: Assigns the specified property. Like SAX1 handlers, these may be changed at any time.

Parameters:
propertyId
value