public abstract class AbstractSAXParser extends AbstractXMLDocumentParser implements XMLReader
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractSAXParser.AttributesProxy |
protected static class |
AbstractSAXParser.LocatorProxy |
| Modifier and Type | Field and Description |
|---|---|
protected ContentHandler |
fContentHandler
Content handler.
|
protected DTDHandler |
fDTDHandler
DTD handler.
|
protected LexicalHandler |
fLexicalHandler
Lexical handler.
|
protected boolean |
fLexicalHandlerParameterEntities
Lexical handler parameter entities.
|
protected NamespaceContext |
fNamespaceContext
Namespace context
|
protected boolean |
fNamespacePrefixes
Namespace prefixes.
|
protected boolean |
fNamespaces
Namespaces.
|
protected boolean |
fStandalone
Standalone document declaration.
|
protected String |
fVersion |
protected static String |
LEXICAL_HANDLER
Property id: lexical handler.
|
protected static String |
NAMESPACES
Feature identifier: namespaces.
|
ERROR_HANDLER, parserConfiguration_| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSAXParser(XMLParserConfiguration config) |
| Modifier and Type | Method and Description |
|---|---|
void |
characters(XMLString text,
Augmentations augs)
Character content.
|
void |
comment(XMLString text,
Augmentations augs)
A comment.
|
void |
doctypeDecl(String rootElement,
String publicId,
String systemId,
Augmentations augs)
Notifies of the presence of the DOCTYPE line in the document.
|
void |
endCDATA(Augmentations augs)
The end of a CDATA section.
|
void |
endDocument(Augmentations augs)
The end of the document.
|
void |
endElement(QName element,
Augmentations augs)
The end of an element.
|
protected void |
endNamespaceMapping()
Send endPrefixMapping events
|
ContentHandler |
getContentHandler()
Return the current content handler.
|
DTDHandler |
getDTDHandler()
Return the current DTD handler.
|
EntityResolver |
getEntityResolver()
Return the current entity resolver.
|
ErrorHandler |
getErrorHandler()
Return the current error handler.
|
boolean |
getFeature(String featureId)
Query the state of a feature.
|
protected LexicalHandler |
getLexicalHandler() |
Object |
getProperty(String propertyId)
Query the value of a property.
|
void |
parse(InputSource inputSource) |
void |
parse(String systemId)
Parses the input source specified by the given system identifier.
|
void |
processingInstruction(String target,
XMLString data,
Augmentations augs)
A processing instruction.
|
void |
reset()
Reset all components before parsing.
|
void |
setContentHandler(ContentHandler contentHandler)
Allow an application to register a content event handler.
|
void |
setDTDHandler(DTDHandler dtdHandler)
Allow an application to register a DTD event handler.
|
void |
setEntityResolver(EntityResolver resolver) |
void |
setErrorHandler(ErrorHandler errorHandler)
Allow an application to register an error event handler.
|
void |
setFeature(String featureId,
boolean state)
Set the state of any feature in a SAX2 parser.
|
protected void |
setLexicalHandler(LexicalHandler handler)
Set the lexical event handler.
|
void |
setProperty(String propertyId,
Object value)
Set the value of any property in a SAX2 parser.
|
void |
startCDATA(Augmentations augs)
The start of a CDATA section.
|
void |
startDocument(XMLLocator locator,
String encoding,
NamespaceContext namespaceContext,
Augmentations augs)
The start of the document.
|
void |
startElement(QName element,
XMLAttributes attributes,
Augmentations augs)
The start of an element.
|
protected void |
startNamespaceMapping()
Send startPrefixMapping events
|
void |
xmlDecl(String version,
String encoding,
String standalone,
Augmentations augs)
Notifies of the presence of an XMLDecl line in the document.
|
emptyElement, getDocumentSource, parse, setDocumentSourceprotected static final String NAMESPACES
protected static final String LEXICAL_HANDLER
protected boolean fNamespaces
protected boolean fNamespacePrefixes
protected boolean fLexicalHandlerParameterEntities
protected boolean fStandalone
protected ContentHandler fContentHandler
protected NamespaceContext fNamespaceContext
protected DTDHandler fDTDHandler
protected LexicalHandler fLexicalHandler
protected String fVersion
protected AbstractSAXParser(XMLParserConfiguration config)
public void startDocument(XMLLocator locator, String encoding, NamespaceContext namespaceContext, Augmentations augs) throws XNIException
startDocument in interface XMLDocumentHandlerstartDocument in class AbstractXMLDocumentParserlocator - The document locator, or null if the document
location cannot be reported during the parsing of
this document. However, it is strongly
recommended that a locator be supplied that can at
least report the system identifier of the document.encoding - The auto-detected IANA encoding name of the entity
stream. This value will be null in those situations
where the entity encoding is not auto-detected (e.g.
internal entities or a document entity that is parsed
from a java.io.Reader).namespaceContext - The namespace context in effect at the start of this
document. This object represents the current context.
Implementors of this class are responsible for
copying the namespace bindings from the the current
context (and its parent contexts) if that information
is important.augs - Additional information that may include infoset
augmentationsXNIException - Thrown by handler to signal an error.public void xmlDecl(String version, String encoding, String standalone, Augmentations augs) throws XNIException
xmlDecl in interface XMLDocumentHandlerxmlDecl in class AbstractXMLDocumentParserversion - The XML version.encoding - The IANA encoding name of the document, or null if not
specified.standalone - The standalone value, or null if not specified.augs - Additional information that may include infoset
augmentationsXNIException - Thrown by handler to signal an error.public void doctypeDecl(String rootElement, String publicId, String systemId, Augmentations augs) throws XNIException
doctypeDecl in interface XMLDocumentHandlerdoctypeDecl in class AbstractXMLDocumentParserrootElement - The name of the root element.publicId - The public identifier if an external DTD or null if the
external DTD is specified using SYSTEM.systemId - The system identifier if an external DTD, null otherwise.augs - Additional information that may include infoset
augmentationsXNIException - Thrown by handler to signal an error.public void startElement(QName element, XMLAttributes attributes, Augmentations augs) throws XNIException
startElement in interface XMLDocumentHandlerstartElement in class AbstractXMLDocumentParserelement - The name of the element.attributes - The element attributes.augs - Additional information that may include infoset
augmentationsXNIException - Thrown by handler to signal an error.public void characters(XMLString text, Augmentations augs) throws XNIException
characters in interface XMLDocumentHandlercharacters in class AbstractXMLDocumentParsertext - The content.augs - Additional information that may include infoset augmentationsXNIException - Thrown by handler to signal an error.public void endElement(QName element, Augmentations augs) throws XNIException
endElement in interface XMLDocumentHandlerendElement in class AbstractXMLDocumentParserelement - The name of the element.augs - Additional information that may include infoset augmentationsXNIException - Thrown by handler to signal an error.public void startCDATA(Augmentations augs) throws XNIException
startCDATA in interface XMLDocumentHandlerstartCDATA in class AbstractXMLDocumentParseraugs - Additional information that may include infoset augmentationsXNIException - Thrown by handler to signal an error.public void endCDATA(Augmentations augs) throws XNIException
endCDATA in interface XMLDocumentHandlerendCDATA in class AbstractXMLDocumentParseraugs - Additional information that may include infoset augmentationsXNIException - Thrown by handler to signal an error.public void comment(XMLString text, Augmentations augs) throws XNIException
comment in interface XMLDocumentHandlercomment in class AbstractXMLDocumentParsertext - The text in the comment.augs - Additional information that may include infoset augmentationsXNIException - Thrown by application to signal an error.public void processingInstruction(String target, XMLString data, Augmentations augs) throws XNIException
Typically, a processing instruction's data will contain a series of pseudo-attributes. These pseudo-attributes follow the form of element attributes but are not parsed or presented to the application as anything other than text. The application is responsible for parsing the data.
processingInstruction in interface XMLDocumentHandlerprocessingInstruction in class AbstractXMLDocumentParsertarget - The target.data - The data or null if none specified.augs - Additional information that may include infoset augmentationsXNIException - Thrown by handler to signal an error.public void endDocument(Augmentations augs) throws XNIException
endDocument in interface XMLDocumentHandlerendDocument in class AbstractXMLDocumentParseraugs - Additional information that may include infoset augmentationsXNIException - Thrown by handler to signal an error.public void parse(String systemId) throws SAXException, IOException
This method is equivalent to the following:
parse(new InputSource(systemId));
parse in interface XMLReadersystemId - The system identifier (URI).SAXException - Throws exception on SAX error.IOException - Throws exception on i/o error.public void parse(InputSource inputSource) throws SAXException, IOException
parse in interface XMLReaderSAXExceptionIOExceptionpublic void setEntityResolver(EntityResolver resolver)
setEntityResolver in interface XMLReaderpublic EntityResolver getEntityResolver()
getEntityResolver in interface XMLReadersetEntityResolver(org.xml.sax.EntityResolver)public void setErrorHandler(ErrorHandler errorHandler)
If the application does not register an error handler, all error events reported by the SAX parser will be silently ignored; however, normal processing may not continue. It is highly recommended that all SAX applications implement an error handler to avoid unexpected bugs.
Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
setErrorHandler in interface XMLReadererrorHandler - The error handler.getErrorHandler()public ErrorHandler getErrorHandler()
getErrorHandler in interface XMLReadersetErrorHandler(org.xml.sax.ErrorHandler)public void setDTDHandler(DTDHandler dtdHandler)
If the application does not register a DTD handler, all DTD events reported by the SAX parser will be silently ignored.
Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
setDTDHandler in interface XMLReaderdtdHandler - The DTD handler.getDTDHandler()public void setContentHandler(ContentHandler contentHandler)
If the application does not register a content handler, all content events reported by the SAX parser will be silently ignored.
Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
setContentHandler in interface XMLReadercontentHandler - The content handler.getContentHandler()public ContentHandler getContentHandler()
getContentHandler in interface XMLReadersetContentHandler(org.xml.sax.ContentHandler)public DTDHandler getDTDHandler()
getDTDHandler in interface XMLReadersetDTDHandler(org.xml.sax.DTDHandler)public void setFeature(String featureId, boolean state) throws SAXNotRecognizedException, SAXNotSupportedException
setFeature in interface XMLReaderfeatureId - The unique identifier (URI) of the feature.state - The requested state of the feature (true or false).SAXNotRecognizedException - If the requested feature is not known.SAXNotSupportedException - If the requested feature is known, but
the requested state is not supported.public boolean getFeature(String featureId) throws SAXNotRecognizedException, SAXNotSupportedException
Query the current state of any feature in a SAX2 parser. The parser might not recognize the feature.
getFeature in interface XMLReaderfeatureId - The unique identifier (URI) of the feature being set.SAXNotRecognizedException - If the requested feature is
not known.SAXNotSupportedException - If the requested feature is
known but not supported.public void setProperty(String propertyId, Object value) throws SAXNotRecognizedException, SAXNotSupportedException
setProperty in interface XMLReaderpropertyId - The unique identifier (URI) of the property being set.value - The value to which the property is being set.SAXNotRecognizedException - If the requested property is not known.SAXNotSupportedException - If the requested property is known, but
the requested value is not supported.public Object getProperty(String propertyId) throws SAXNotRecognizedException, SAXNotSupportedException
Return the current value of a property in a SAX2 parser. The parser might not recognize the property.
getProperty in interface XMLReaderpropertyId - The unique identifier (URI) of the property being set.SAXNotRecognizedException - If the requested property is
not known.SAXNotSupportedException - If the requested property is
known but not supported.protected void setLexicalHandler(LexicalHandler handler) throws SAXNotSupportedException
This method is the equivalent to the property:
http://xml.org/sax/properties/lexical-handler
handler - lexical event handlerSAXNotSupportedException - on errorgetLexicalHandler(),
setProperty(String, Object)protected LexicalHandler getLexicalHandler()
setLexicalHandler(LexicalHandler)protected final void startNamespaceMapping()
throws SAXException
SAXException - on errorprotected final void endNamespaceMapping()
throws SAXException
SAXException - on errorpublic void reset()
throws XNIException
reset in class AbstractXMLDocumentParserXNIException - Thrown if an error occurs during initialization.Copyright © 2024 HtmlUnit. All rights reserved.