|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfi.iki.hsivonen.gnu.xml.aelfred2.SAXDriver
public final class SAXDriver
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.
Name | Notes |
---|---|
(URL)/external-general-entities | Value defaults to true |
(URL)/external-parameter-entities | Value 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-prefixes | Value defaults to false (but XML 1.0 names are always reported) |
(URL)/lexical-handler/parameter-entities | Value is fixed at true |
(URL)/namespaces | Value defaults to true |
(URL)/resolve-dtd-uris | (PRELIMINARY) Value defaults to true |
(URL)/string-interning | Value is fixed at true |
(URL)/use-attributes2 | (PRELIMINARY) Value is fixed at true |
(URL)/use-entity-resolver2 | (PRELIMINARY) Value defaults to true |
(URL)/validation | Value is fixed at false |
(URL)/declaration-handler | A declaration handler may be provided. |
(URL)/lexical-handler | A lexical handler may be provided. |
This parser currently implements the SAX1 Parser API, but it may not continue to do so in the future.
Parser
Nested Class Summary | |
---|---|
private static class |
SAXDriver.Adapter
|
private static class |
SAXDriver.Attribute
|
Field Summary | |
---|---|
private int |
attributeCount
|
private boolean |
attributes
|
private List<SAXDriver.Attribute> |
attributesList
|
private DefaultHandler2 |
base
|
(package private) boolean |
checkNormalization
|
private ContentHandler |
contentHandler
|
private DeclHandler |
declHandler
|
private DTDHandler |
dtdHandler
|
private String |
elementName
|
private EntityResolver |
entityResolver
|
private Stack<String> |
entityStack
|
private ErrorHandler |
errorHandler
|
private boolean |
extGE
|
private boolean |
extPE
|
(package private) static String |
FEATURE
|
private LexicalHandler |
lexicalHandler
|
private boolean |
namespaces
|
private String[] |
nsTemp
|
private XmlParser |
parser
|
private NamespaceSupport |
prefixStack
|
(package private) static String |
PROPERTY
|
private boolean |
resolveAll
|
private EntityResolver2 |
resolver2
|
(package private) boolean |
stringInterning
|
private boolean |
useResolver2
|
private boolean |
xmlNames
|
Constructor Summary | |
---|---|
SAXDriver()
Constructs a SAX Parser. |
Method Summary | |
---|---|
(package private) String |
absolutize(String baseURI,
String systemId,
boolean nice)
|
(package private) void |
attribute(String qname,
String value,
boolean isSpecified)
|
(package private) void |
charData(char[] ch,
int start,
int length)
|
(package private) void |
comment(char[] ch,
int start,
int length)
|
private void |
declarePrefix(String prefix,
String uri)
|
(package private) void |
doctypeDecl(String name,
String publicId,
String systemId)
|
(package private) void |
endCDATA()
|
(package private) void |
endDoctype()
|
(package private) void |
endElement(String elname)
|
(package private) void |
endExternalEntity(String name)
|
(package private) void |
endInternalEntity(String name)
|
(package private) void |
fatal(String message)
|
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. |
(package private) DeclHandler |
getDeclHandler()
|
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; |
(package private) InputSource |
getExternalSubset(String name,
String baseURI)
|
boolean |
getFeature(String featureId)
SAX2: Tells the value of the specified feature flag. |
int |
getIndex(String xmlName)
SAX2 Attributes method (don't invoke on parser); |
int |
getIndex(String uri,
String local)
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); |
String |
getLocalName(int index)
SAX2 Attributes method (don't invoke on parser); |
String |
getName(int index)
SAX1 AttributeList method (don't invoke on parser); |
Object |
getProperty(String propertyId)
SAX2: Returns the specified property. |
String |
getPublicId()
SAX Locator method (don't invoke on parser); |
String |
getQName(int index)
SAX2 Attributes method (don't invoke on parser); |
String |
getSystemId()
SAX Locator method (don't invoke on parser); |
String |
getType(int index)
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser); |
String |
getType(String xmlName)
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser); |
String |
getType(String uri,
String local)
SAX2 Attributes method (don't invoke on parser); |
String |
getURI(int index)
SAX2 Attributes method (don't invoke on parser); |
String |
getValue(int index)
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser); |
String |
getValue(String xmlName)
SAX1 AttributeList, SAX2 Attributes method (don't invoke on parser); |
String |
getValue(String uri,
String local)
SAX Attributes method (don't invoke on parser); |
(package private) void |
ignorableWhitespace(char[] ch,
int start,
int length)
|
boolean |
isDeclared(int index)
|
boolean |
isDeclared(String qName)
|
boolean |
isDeclared(String uri,
String localName)
|
boolean |
isSpecified(int index)
SAX-ext Attributes2 method (don't invoke on parser); |
boolean |
isSpecified(String xmlName)
SAX-ext Attributes2 method (don't invoke on parser); |
boolean |
isSpecified(String uri,
String local)
SAX-ext Attributes2 method (don't invoke on parser); |
(package private) void |
notationDecl(String name,
String publicId,
String systemId,
String baseUri)
|
void |
parse(InputSource source)
SAX1, SAX2: Auxiliary API to parse an XML document, used mostly when no URI is available. |
void |
parse(String systemId)
SAX1, SAX2: Preferred API to parse an XML document, using a system identifier (URI). |
(package private) void |
processingInstruction(String target,
String data)
|
private void |
reset()
|
(package private) InputSource |
resolveEntity(boolean isPE,
String name,
InputSource in,
String baseURI)
|
(package private) boolean |
resolveURIs()
|
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 value)
SAX2: Sets the state of feature flags in this parser. |
void |
setLocale(Locale locale)
SAX1: Sets the locale used for diagnostics; currently, only locales using the English language are supported. |
void |
setProperty(String propertyId,
Object value)
SAX2: Assigns the specified property. |
(package private) void |
skippedEntity(String name)
|
(package private) void |
startCDATA()
|
(package private) void |
startDocument()
|
(package private) void |
startElement(String elname)
|
(package private) void |
startExternalEntity(String name,
String systemId,
boolean stackOnly)
|
(package private) void |
startInternalEntity(String name)
|
(package private) void |
unparsedEntityDecl(String name,
String publicId,
String systemId,
String baseUri,
String notation)
|
(package private) void |
verror(String message)
|
(package private) void |
warn(String message)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final DefaultHandler2 base
private XmlParser parser
private EntityResolver entityResolver
private EntityResolver2 resolver2
private ContentHandler contentHandler
private DTDHandler dtdHandler
private ErrorHandler errorHandler
private DeclHandler declHandler
private LexicalHandler lexicalHandler
private String elementName
private Stack<String> entityStack
private List<SAXDriver.Attribute> attributesList
private boolean namespaces
private boolean xmlNames
private boolean extGE
private boolean extPE
private boolean resolveAll
private boolean useResolver2
boolean stringInterning
private int attributeCount
private boolean attributes
private String[] nsTemp
private NamespaceSupport prefixStack
boolean checkNormalization
static final String FEATURE
static final String PROPERTY
Constructor Detail |
---|
public SAXDriver()
Method Detail |
---|
private void reset()
public void setLocale(Locale locale) throws SAXException
setLocale
in interface Parser
locale
- The locale for which diagnostics will be generated
SAXException
public EntityResolver getEntityResolver()
getEntityResolver
in interface XMLReader
public void setEntityResolver(EntityResolver resolver)
setEntityResolver
in interface Parser
setEntityResolver
in interface XMLReader
handler
- The object to receive entity events.public DTDHandler getDTDHandler()
getDTDHandler
in interface XMLReader
public void setDTDHandler(DTDHandler handler)
setDTDHandler
in interface Parser
setDTDHandler
in interface XMLReader
handler
- The object to receive DTD events.public void setDocumentHandler(DocumentHandler handler)
setDocumentHandler
in interface Parser
handler
- The object to receive document events.public ContentHandler getContentHandler()
getContentHandler
in interface XMLReader
public void setContentHandler(ContentHandler handler)
setContentHandler
in interface XMLReader
public void setErrorHandler(ErrorHandler handler)
setErrorHandler
in interface Parser
setErrorHandler
in interface XMLReader
handler
- The object to receive error events.public ErrorHandler getErrorHandler()
getErrorHandler
in interface XMLReader
public void parse(InputSource source) throws SAXException, IOException
parse
in interface Parser
parse
in interface XMLReader
source
- The XML input source. Don't set 'encoding' unless
you know for a fact that it's correct.
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.setEntityResolver(org.xml.sax.EntityResolver)
,
setDTDHandler(org.xml.sax.DTDHandler)
,
setContentHandler(org.xml.sax.ContentHandler)
,
setErrorHandler(org.xml.sax.ErrorHandler)
public void parse(String systemId) throws SAXException, IOException
parse
in interface Parser
parse
in interface XMLReader
SAXException
IOException
public boolean getFeature(String featureId) throws SAXNotRecognizedException, SAXNotSupportedException
getFeature
in interface XMLReader
SAXNotRecognizedException
- thrown if the feature flag
is neither built in, nor yet assigned.
SAXNotSupportedException
DeclHandler getDeclHandler()
boolean resolveURIs()
public Object getProperty(String propertyId) throws SAXNotRecognizedException
getProperty
in interface XMLReader
SAXNotRecognizedException
- thrown if the property value
is neither built in, nor yet stored.public void setFeature(String featureId, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException
setFeature
in interface XMLReader
SAXNotRecognizedException
SAXNotSupportedException
public void setProperty(String propertyId, Object value) throws SAXNotRecognizedException, SAXNotSupportedException
setProperty
in interface XMLReader
SAXNotRecognizedException
SAXNotSupportedException
void startDocument() throws SAXException
SAXException
void skippedEntity(String name) throws SAXException
SAXException
InputSource getExternalSubset(String name, String baseURI) throws SAXException, IOException
SAXException
IOException
InputSource resolveEntity(boolean isPE, String name, InputSource in, String baseURI) throws SAXException, IOException
SAXException
IOException
String absolutize(String baseURI, String systemId, boolean nice) throws MalformedURLException, SAXException
MalformedURLException
SAXException
void startExternalEntity(String name, String systemId, boolean stackOnly) throws SAXException
SAXException
void endExternalEntity(String name) throws SAXException
SAXException
void startInternalEntity(String name) throws SAXException
SAXException
void endInternalEntity(String name) throws SAXException
SAXException
void doctypeDecl(String name, String publicId, String systemId) throws SAXException
SAXException
void notationDecl(String name, String publicId, String systemId, String baseUri) throws SAXException
SAXException
void unparsedEntityDecl(String name, String publicId, String systemId, String baseUri, String notation) throws SAXException
SAXException
void endDoctype() throws SAXException
SAXException
private void declarePrefix(String prefix, String uri) throws SAXException
SAXException
void attribute(String qname, String value, boolean isSpecified) throws SAXException
SAXException
void startElement(String elname) throws SAXException
SAXException
void endElement(String elname) throws SAXException
SAXException
void startCDATA() throws SAXException
SAXException
void charData(char[] ch, int start, int length) throws SAXException
SAXException
void endCDATA() throws SAXException
SAXException
void ignorableWhitespace(char[] ch, int start, int length) throws SAXException
SAXException
void processingInstruction(String target, String data) throws SAXException
SAXException
void comment(char[] ch, int start, int length) throws SAXException
SAXException
void fatal(String message) throws SAXException
SAXException
void verror(String message) throws SAXException
SAXException
void warn(String message) throws SAXException
SAXException
public int getLength()
getLength
in interface AttributeList
getLength
in interface Attributes
public String getURI(int index)
getURI
in interface Attributes
public String getLocalName(int index)
getLocalName
in interface Attributes
public String getQName(int index)
getQName
in interface Attributes
public String getName(int index)
getName
in interface AttributeList
public String getType(int index)
getType
in interface AttributeList
getType
in interface Attributes
public String getValue(int index)
getValue
in interface AttributeList
getValue
in interface Attributes
public int getIndex(String uri, String local)
getIndex
in interface Attributes
public int getIndex(String xmlName)
getIndex
in interface Attributes
public String getType(String uri, String local)
getType
in interface Attributes
public String getType(String xmlName)
getType
in interface AttributeList
getType
in interface Attributes
public String getValue(String uri, String local)
getValue
in interface Attributes
public String getValue(String xmlName)
getValue
in interface AttributeList
getValue
in interface Attributes
public boolean isDeclared(int index)
isDeclared
in interface Attributes2
ArrayIndexOutOfBoundsException
- When the supplied index does not identify an attribute.public boolean isDeclared(String qName)
isDeclared
in interface Attributes2
IllegalArgumentException
- When the supplied names do not identify an attribute.public boolean isDeclared(String uri, String localName)
isDeclared
in interface Attributes2
IllegalArgumentException
- When the supplied names do not identify an attribute.public boolean isSpecified(int index)
isSpecified
in interface Attributes2
public boolean isSpecified(String uri, String local)
isSpecified
in interface Attributes2
public boolean isSpecified(String xmlName)
isSpecified
in interface Attributes2
public String getPublicId()
getPublicId
in interface Locator
public String getSystemId()
getSystemId
in interface Locator
public int getLineNumber()
getLineNumber
in interface Locator
public int getColumnNumber()
getColumnNumber
in interface Locator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |