Package com.icl.saxon.aelfred
Class SAXDriver
- java.lang.Object
-
- com.icl.saxon.aelfred.SAXDriver
-
- All Implemented Interfaces:
org.xml.sax.AttributeList,org.xml.sax.Attributes,org.xml.sax.Locator,org.xml.sax.Parser,org.xml.sax.XMLReader
public class SAXDriver extends java.lang.Object implements org.xml.sax.Locator, org.xml.sax.Attributes, org.xml.sax.XMLReader, org.xml.sax.Parser, org.xml.sax.AttributeListAn 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:
Parser
-
-
Constructor Summary
Constructors Constructor Description SAXDriver()Constructs a SAX Parser.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description (package private) voidattribute(java.lang.String aname, java.lang.String value, boolean isSpecified)(package private) voidcharData(char[] ch, int start, int length)(package private) voidcomment(char[] ch, int start, int length)(package private) voiddoctypeDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)(package private) voidendCDATA()(package private) voidendDoctype()(package private) voidendDocument()(package private) voidendElement(java.lang.String elname)(package private) voidendExternalEntity(java.lang.String systemId)(package private) voiderror(java.lang.String message, java.lang.String url, int line, int column)intgetColumnNumber()SAX Locator method (don't invoke on parser);org.xml.sax.ContentHandlergetContentHandler()SAX2: Returns the object used to report the logical content of an XML document.org.xml.sax.DTDHandlergetDTDHandler()SAX2: Returns the object used to process declarations related to notations and unparsed entities.org.xml.sax.EntityResolvergetEntityResolver()SAX2: Returns the object used when resolving external entities during parsing (both general and parameter entities).org.xml.sax.ErrorHandlergetErrorHandler()SAX2: Returns the object used to receive callbacks for XML errors of all levels (fatal, nonfatal, warning); this is never null;booleangetFeature(java.lang.String featureId)SAX2: Tells the value of the specified feature flag.intgetIndex(java.lang.String xmlName)SAX2 Attributes method (don't invoke on parser);intgetIndex(java.lang.String uri, java.lang.String local)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);java.lang.StringgetLocalName(int index)SAX2 Attributes method (don't invoke on parser);java.lang.StringgetName(int i)SAX1 AttributeList method (don't invoke on parser);java.lang.ObjectgetProperty(java.lang.String propertyId)SAX2: Returns the specified property.java.lang.StringgetPublicId()SAX Locator method (don't invoke on parser);java.lang.StringgetQName(int i)SAX2 Attributes method (don't invoke on parser);java.lang.StringgetSystemId()SAX Locator method (don't invoke on parser);java.lang.StringgetType(int i)SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);java.lang.StringgetType(java.lang.String xmlName)SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);java.lang.StringgetType(java.lang.String uri, java.lang.String local)SAX2 Attributes method (don't invoke on parser);java.lang.StringgetURI(int index)SAX2 Attributes method (don't invoke on parser);java.lang.StringgetValue(int i)SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);java.lang.StringgetValue(java.lang.String xmlName)SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);java.lang.StringgetValue(java.lang.String uri, java.lang.String local)SAX Attributes method (don't invoke on parser);(package private) voidignorableWhitespace(char[] ch, int start, int length)voidparse(java.lang.String systemId)SAX1, SAX2: Preferred API to parse an XML document, using a system identifier (URI).voidparse(org.xml.sax.InputSource source)SAX1, SAX2: Auxiliary API to parse an XML document, used mostly when no URI is available.(package private) voidprocessingInstruction(java.lang.String target, java.lang.String data)(package private) java.lang.ObjectresolveEntity(java.lang.String publicId, java.lang.String systemId)voidsetContentHandler(org.xml.sax.ContentHandler handler)SAX2: Assigns the object used to report the logical content of an XML document.voidsetDocumentHandler(org.xml.sax.DocumentHandler handler)Deprecated.SAX2 programs should use the XMLReader interface and a ContentHandler.voidsetDTDHandler(org.xml.sax.DTDHandler handler)SAX1, SAX2: Set the DTD handler for this parser.voidsetEntityResolver(org.xml.sax.EntityResolver resolver)SAX1, SAX2: Set the entity resolver for this parser.voidsetErrorHandler(org.xml.sax.ErrorHandler handler)SAX1, SAX2: Set the error handler for this parser.voidsetFeature(java.lang.String featureId, boolean state)SAX2: Sets the state of feature flags in this parser.voidsetLocale(java.util.Locale locale)SAX1: Sets the locale used for diagnostics; currently, only locales using the English language are supported.voidsetProperty(java.lang.String propertyId, java.lang.Object property)SAX2: Assigns the specified property.(package private) voidstartCDATA()(package private) voidstartDocument()(package private) voidstartElement(java.lang.String elname)(package private) voidstartExternalEntity(java.lang.String systemId)
-
-
-
Field Detail
-
FEATURE
static final java.lang.String FEATURE
- See Also:
- Constant Field Values
-
HANDLER
static final java.lang.String HANDLER
- See Also:
- Constant Field Values
-
-
Method Detail
-
setLocale
public void setLocale(java.util.Locale locale) throws org.xml.sax.SAXExceptionSAX1: Sets the locale used for diagnostics; currently, only locales using the English language are supported.- Specified by:
setLocalein interfaceorg.xml.sax.Parser- Parameters:
locale- The locale for which diagnostics will be generated- Throws:
org.xml.sax.SAXException
-
getEntityResolver
public org.xml.sax.EntityResolver getEntityResolver()
SAX2: Returns the object used when resolving external entities during parsing (both general and parameter entities).- Specified by:
getEntityResolverin interfaceorg.xml.sax.XMLReader
-
setEntityResolver
public void setEntityResolver(org.xml.sax.EntityResolver resolver)
SAX1, SAX2: Set the entity resolver for this parser.- Specified by:
setEntityResolverin interfaceorg.xml.sax.Parser- Specified by:
setEntityResolverin interfaceorg.xml.sax.XMLReader- Parameters:
handler- The object to receive entity events.
-
getDTDHandler
public org.xml.sax.DTDHandler getDTDHandler()
SAX2: Returns the object used to process declarations related to notations and unparsed entities.- Specified by:
getDTDHandlerin interfaceorg.xml.sax.XMLReader
-
setDTDHandler
public void setDTDHandler(org.xml.sax.DTDHandler handler)
SAX1, SAX2: Set the DTD handler for this parser.- Specified by:
setDTDHandlerin interfaceorg.xml.sax.Parser- Specified by:
setDTDHandlerin interfaceorg.xml.sax.XMLReader- Parameters:
handler- The object to receive DTD events.
-
setDocumentHandler
public void setDocumentHandler(org.xml.sax.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).- Specified by:
setDocumentHandlerin interfaceorg.xml.sax.Parser- Parameters:
handler- The object to receive document events.
-
getContentHandler
public org.xml.sax.ContentHandler getContentHandler()
SAX2: Returns the object used to report the logical content of an XML document.- Specified by:
getContentHandlerin interfaceorg.xml.sax.XMLReader
-
setContentHandler
public void setContentHandler(org.xml.sax.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).- Specified by:
setContentHandlerin interfaceorg.xml.sax.XMLReader
-
setErrorHandler
public void setErrorHandler(org.xml.sax.ErrorHandler handler)
SAX1, SAX2: Set the error handler for this parser.- Specified by:
setErrorHandlerin interfaceorg.xml.sax.Parser- Specified by:
setErrorHandlerin interfaceorg.xml.sax.XMLReader- Parameters:
handler- The object to receive error events.
-
getErrorHandler
public org.xml.sax.ErrorHandler getErrorHandler()
SAX2: Returns the object used to receive callbacks for XML errors of all levels (fatal, nonfatal, warning); this is never null;- Specified by:
getErrorHandlerin interfaceorg.xml.sax.XMLReader
-
parse
public void parse(org.xml.sax.InputSource source) throws org.xml.sax.SAXException, java.io.IOExceptionSAX1, 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:
parsein interfaceorg.xml.sax.Parser- Specified by:
parsein interfaceorg.xml.sax.XMLReader- Parameters:
source- The XML input source. Don't set 'encoding' unless you know for a fact that it's correct.- Throws:
org.xml.sax.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(org.xml.sax.EntityResolver),setDTDHandler(org.xml.sax.DTDHandler),setContentHandler(org.xml.sax.ContentHandler),setErrorHandler(org.xml.sax.ErrorHandler)
-
parse
public void parse(java.lang.String systemId) throws org.xml.sax.SAXException, java.io.IOExceptionSAX1, SAX2: Preferred API to parse an XML document, using a system identifier (URI).- Specified by:
parsein interfaceorg.xml.sax.Parser- Specified by:
parsein interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXExceptionjava.io.IOException
-
getFeature
public boolean getFeature(java.lang.String featureId) throws org.xml.sax.SAXNotRecognizedExceptionSAX2: Tells the value of the specified feature flag.- Specified by:
getFeaturein interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedException- thrown if the feature flag is neither built in, nor yet assigned.
-
getProperty
public java.lang.Object getProperty(java.lang.String propertyId) throws org.xml.sax.SAXNotRecognizedExceptionSAX2: Returns the specified property.- Specified by:
getPropertyin interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedException- thrown if the property value is neither built in, nor yet stored.
-
setFeature
public void setFeature(java.lang.String featureId, boolean state) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionSAX2: 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:
setFeaturein interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedExceptionorg.xml.sax.SAXNotSupportedException
-
setProperty
public void setProperty(java.lang.String propertyId, java.lang.Object property) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionSAX2: Assigns the specified property. Like SAX1 handlers, these may be changed at any time.- Specified by:
setPropertyin interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedExceptionorg.xml.sax.SAXNotSupportedException
-
startDocument
void startDocument() throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
endDocument
void endDocument() throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
resolveEntity
java.lang.Object resolveEntity(java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException, java.io.IOException- Throws:
org.xml.sax.SAXExceptionjava.io.IOException
-
startExternalEntity
void startExternalEntity(java.lang.String systemId) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
endExternalEntity
void endExternalEntity(java.lang.String systemId) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
doctypeDecl
void doctypeDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
endDoctype
void endDoctype() throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
attribute
void attribute(java.lang.String aname, java.lang.String value, boolean isSpecified) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
startElement
void startElement(java.lang.String elname) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
endElement
void endElement(java.lang.String elname) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
startCDATA
void startCDATA() throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
charData
void charData(char[] ch, int start, int length) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
endCDATA
void endCDATA() throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
ignorableWhitespace
void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
processingInstruction
void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
comment
void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
error
void error(java.lang.String message, java.lang.String url, int line, int column) throws org.xml.sax.SAXException- Throws:
org.xml.sax.SAXException
-
getLength
public int getLength()
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);- Specified by:
getLengthin interfaceorg.xml.sax.AttributeList- Specified by:
getLengthin interfaceorg.xml.sax.Attributes
-
getURI
public java.lang.String getURI(int index)
SAX2 Attributes method (don't invoke on parser);- Specified by:
getURIin interfaceorg.xml.sax.Attributes
-
getLocalName
public java.lang.String getLocalName(int index)
SAX2 Attributes method (don't invoke on parser);- Specified by:
getLocalNamein interfaceorg.xml.sax.Attributes
-
getQName
public java.lang.String getQName(int i)
SAX2 Attributes method (don't invoke on parser);- Specified by:
getQNamein interfaceorg.xml.sax.Attributes
-
getName
public java.lang.String getName(int i)
SAX1 AttributeList method (don't invoke on parser);- Specified by:
getNamein interfaceorg.xml.sax.AttributeList
-
getType
public java.lang.String getType(int i)
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);- Specified by:
getTypein interfaceorg.xml.sax.AttributeList- Specified by:
getTypein interfaceorg.xml.sax.Attributes
-
getValue
public java.lang.String getValue(int i)
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);- Specified by:
getValuein interfaceorg.xml.sax.AttributeList- Specified by:
getValuein interfaceorg.xml.sax.Attributes
-
getIndex
public int getIndex(java.lang.String uri, java.lang.String local)SAX2 Attributes method (don't invoke on parser);- Specified by:
getIndexin interfaceorg.xml.sax.Attributes
-
getIndex
public int getIndex(java.lang.String xmlName)
SAX2 Attributes method (don't invoke on parser);- Specified by:
getIndexin interfaceorg.xml.sax.Attributes
-
getType
public java.lang.String getType(java.lang.String uri, java.lang.String local)SAX2 Attributes method (don't invoke on parser);- Specified by:
getTypein interfaceorg.xml.sax.Attributes
-
getType
public java.lang.String getType(java.lang.String xmlName)
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);- Specified by:
getTypein interfaceorg.xml.sax.AttributeList- Specified by:
getTypein interfaceorg.xml.sax.Attributes
-
getValue
public java.lang.String getValue(java.lang.String uri, java.lang.String local)SAX Attributes method (don't invoke on parser);- Specified by:
getValuein interfaceorg.xml.sax.Attributes
-
getValue
public java.lang.String getValue(java.lang.String xmlName)
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser);- Specified by:
getValuein interfaceorg.xml.sax.AttributeList- Specified by:
getValuein interfaceorg.xml.sax.Attributes
-
getPublicId
public java.lang.String getPublicId()
SAX Locator method (don't invoke on parser);- Specified by:
getPublicIdin interfaceorg.xml.sax.Locator
-
getSystemId
public java.lang.String getSystemId()
SAX Locator method (don't invoke on parser);- Specified by:
getSystemIdin interfaceorg.xml.sax.Locator
-
getLineNumber
public int getLineNumber()
SAX Locator method (don't invoke on parser);- Specified by:
getLineNumberin interfaceorg.xml.sax.Locator
-
getColumnNumber
public int getColumnNumber()
SAX Locator method (don't invoke on parser);- Specified by:
getColumnNumberin interfaceorg.xml.sax.Locator
-
-