org.apache.xerces.parsers
public abstract class AbstractSAXParser extends AbstractXMLDocumentParser implements PSVIProvider, Parser, XMLReader
Version: $Id: AbstractSAXParser.java,v 1.59 2005/06/24 02:33:43 mrglavas Exp $
Nested Class Summary | |
---|---|
protected static class | AbstractSAXParser.AttributesProxy |
protected class | AbstractSAXParser.LocatorProxy |
Field Summary | |
---|---|
protected static String | ALLOW_UE_AND_NOTATION_EVENTS Feature identifier: allow notation and unparsed entity events to be sent out of order. |
protected static String | DECLARATION_HANDLER Property id: declaration handler. |
protected static String | DOM_NODE Property id: DOM node. |
protected ContentHandler | fContentHandler Content handler. |
protected SymbolHash | fDeclaredAttrs |
protected DeclHandler | fDeclHandler Decl handler. |
protected DocumentHandler | fDocumentHandler Document 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 | fParseInProgress
True if a parse is in progress. |
protected QName | fQName |
protected boolean | fResolveDTDURIs Resolve DTD URIs. |
protected boolean | fStandalone Standalone document declaration. |
protected boolean | fUseEntityResolver2 Use EntityResolver2. |
protected String | fVersion |
protected boolean | fXMLNSURIs
XMLNS URIs: Namespace declarations in the
http://www.w3.org/2000/xmlns/ namespace. |
protected static String | LEXICAL_HANDLER Property id: lexical handler. |
protected static String | NAMESPACES Feature identifier: namespaces. |
protected static String | NAMESPACE_PREFIXES Feature identifier: namespace prefixes. |
protected static String | STRING_INTERNING Feature id: string interning. |
Constructor Summary | |
---|---|
protected | AbstractSAXParser(XMLParserConfiguration config) Default constructor. |
Method Summary | |
---|---|
void | attributeDecl(String elementName, String attributeName, String type, String[] enumeration, String defaultType, XMLString defaultValue, XMLString nonNormalizedDefaultValue, Augmentations augs)
An attribute declaration.
|
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 | elementDecl(String name, String contentModel, Augmentations augs)
An element declaration.
|
void | endCDATA(Augmentations augs)
The end of a CDATA section. |
void | endDocument(Augmentations augs)
The end of the document. |
void | endDTD(Augmentations augs)
The end of the DTD.
|
void | endElement(QName element, Augmentations augs)
The end of an element.
|
void | endExternalSubset(Augmentations augs)
The end of the DTD external subset.
|
void | endGeneralEntity(String name, Augmentations augs)
This method notifies the end of an entity. |
protected void | endNamespaceMapping()
Send endPrefixMapping events |
void | endParameterEntity(String name, Augmentations augs)
This method notifies the end of an entity. |
void | externalEntityDecl(String name, XMLResourceIdentifier identifier, Augmentations augs)
An external entity declaration.
|
AttributePSVI | getAttributePSVI(int index) |
AttributePSVI | getAttributePSVIByName(String uri, String localname) |
ContentHandler | getContentHandler()
Return the current content handler.
|
protected DeclHandler | getDeclHandler()
Returns the DTD declaration event handler.
|
DTDHandler | getDTDHandler()
Return the current DTD handler.
|
ElementPSVI | getElementPSVI() |
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()
Returns the lexical handler.
|
Object | getProperty(String propertyId)
Query the value of a property.
|
void | ignorableWhitespace(XMLString text, Augmentations augs)
Ignorable whitespace. |
void | internalEntityDecl(String name, XMLString text, XMLString nonNormalizedText, Augmentations augs)
An internal entity declaration.
|
void | notationDecl(String name, XMLResourceIdentifier identifier, Augmentations augs)
A notation declaration
|
void | parse(String systemId)
Parses the input source specified by the given system identifier.
|
void | parse(InputSource inputSource)
parse
|
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.
|
protected void | setDeclHandler(DeclHandler handler)
Set the DTD declaration event handler.
|
void | setDocumentHandler(DocumentHandler documentHandler)
Allow an application to register a document event handler.
|
void | setDTDHandler(DTDHandler dtdHandler)
Allow an application to register a DTD event handler.
|
void | setEntityResolver(EntityResolver resolver)
Sets the resolver used to resolve external entities. |
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 | setLocale(Locale locale)
Set the locale to use for messages.
|
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. |
void | startExternalSubset(XMLResourceIdentifier identifier, Augmentations augs)
The start of the DTD external subset.
|
void | startGeneralEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs)
This method notifies of the start of an entity. |
protected void | startNamespaceMapping()
Send startPrefixMapping events |
void | startParameterEntity(String name, XMLResourceIdentifier identifier, String encoding, Augmentations augs)
This method notifies of the start of parameter entity. |
void | unparsedEntityDecl(String name, XMLResourceIdentifier identifier, String notation, Augmentations augs)
An unparsed entity declaration.
|
void | xmlDecl(String version, String encoding, String standalone, Augmentations augs)
Notifies of the presence of an XMLDecl line in the document. |
Parameters: elementName The name of the element that this attribute is associated with. attributeName The name of the attribute. type The attribute type. This value will be one of the following: "CDATA", "ENTITY", "ENTITIES", "ENUMERATION", "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", or "NOTATION". enumeration If the type has the value "ENUMERATION" or "NOTATION", this array holds the allowed attribute values; otherwise, this array is null. defaultType The attribute default type. This value will be one of the following: "#FIXED", "#IMPLIED", "#REQUIRED", or null. defaultValue The attribute default value, or null if no default value is specified. nonNormalizedDefaultValue The attribute default value with no normalization performed, or null if no default value is specified. augs Additional information that may include infoset augmentations.
Throws: XNIException Thrown by handler to signal an error.
Parameters: text The content. augs Additional information that may include infoset augmentations
Throws: XNIException Thrown by handler to signal an error.
Parameters: text The text in the comment. augs Additional information that may include infoset augmentations
Throws: XNIException Thrown by application to signal an error.
Parameters: rootElement 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 augmentations
Throws: XNIException Thrown by handler to signal an error.
Parameters: name The name of the element. contentModel The element content model. augs Additional information that may include infoset augmentations.
Throws: XNIException Thrown by handler to signal an error.
Parameters: augs Additional information that may include infoset augmentations
Throws: XNIException Thrown by handler to signal an error.
Parameters: augs Additional information that may include infoset augmentations
Throws: XNIException Thrown by handler to signal an error.
Parameters: augs Additional information that may include infoset augmentations.
Throws: XNIException Thrown by handler to signal an error.
Parameters: element The name of the element. augs Additional information that may include infoset augmentations
Throws: XNIException Thrown by handler to signal an error.
Parameters: augs Additional information that may include infoset augmentations.
Throws: XNIException Thrown by handler to signal an error.
Note: Since the document is an entity, the handler will be notified of the end of the document entity by calling the endEntity method with the entity name "[xml]" after calling the endDocument method. When exposing entity boundaries through the SAX API, the document entity is never reported, however.
Note: This method is not called for entity references appearing as part of attribute values.
Parameters: name The name of the entity. augs Additional information that may include infoset augmentations
Throws: XNIException Thrown by handler to signal an error.
Note: Since the document is an entity, the handler will be notified of the end of the document entity by calling the endEntity method with the entity name "[xml]" after calling the endDocument method. When exposing entity boundaries through the SAX API, the document entity is never reported, however.
Note: This method is not called for entity references appearing as part of attribute values.
Parameters: name The name of the parameter entity. augs Additional information that may include infoset augmentations.
Throws: XNIException Thrown by handler to signal an error.
Parameters: name The name of the entity. Parameter entity names start with '%', whereas the name of a general entity is just the entity name. identifier An object containing all location information pertinent to this entity. augs Additional information that may include infoset augmentations.
Throws: XNIException Thrown by handler to signal an error.
Returns: The current content handler, or null if none has been registered.
See Also: AbstractSAXParser
See Also: AbstractSAXParser
Returns: The current DTD handler, or null if none has been registered.
See Also: AbstractSAXParser
Returns: The current entity resolver, or null if none has been registered.
See Also: AbstractSAXParser
Returns: The current error handler, or null if none has been registered.
See Also: AbstractSAXParser
Parameters: featureId The unique identifier (URI) of the feature being set.
Returns: The current state of the feature.
Throws: org.xml.sax.SAXNotRecognizedException If the requested feature is not known. SAXNotSupportedException If the requested feature is known but not supported.
See Also: AbstractSAXParser
Parameters: propertyId The unique identifier (URI) of the property being set.
Returns: The current value of the property.
Throws: org.xml.sax.SAXNotRecognizedException If the requested property is not known. SAXNotSupportedException If the requested property is known but not supported.
Parameters: text The ignorable whitespace. augs Additional information that may include infoset augmentations
Throws: XNIException Thrown by handler to signal an error.
Parameters: name The name of the entity. Parameter entity names start with '%', whereas the name of a general entity is just the entity name. text The value of the entity. nonNormalizedText The non-normalized value of the entity. This value contains the same sequence of characters that was in the internal entity declaration, without any entity references expanded. augs Additional information that may include infoset augmentations.
Throws: XNIException Thrown by handler to signal an error.
Parameters: name The name of the notation. identifier An object containing all location information pertinent to this notation. augs Additional information that may include infoset augmentations.
Throws: XNIException Thrown by handler to signal an error.
This method is equivalent to the following:
parse(new InputSource(systemId));
Parameters: systemId The system identifier (URI).
Throws: org.xml.sax.SAXException Throws exception on SAX error. java.io.IOException Throws exception on i/o error.
Parameters: inputSource
Throws: org.xml.sax.SAXException java.io.IOException
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.
Parameters: target The target. data The data or null if none specified. augs Additional information that may include infoset augmentations
Throws: XNIException Thrown by handler to signal an error.
Throws: XNIException Thrown if an error occurs during initialization.
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.
Parameters: contentHandler The content handler.
See Also: AbstractSAXParser
This method is the equivalent to the property:
http://xml.org/sax/properties/declaration-handler
Parameters: handler The new handler.
See Also: AbstractSAXParser AbstractSAXParser
If the application does not register a document handler, all document events reported by the SAX parser will be silently ignored (this is the default behaviour implemented by HandlerBase).
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.
Parameters: documentHandler The document handler.
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.
Parameters: dtdHandler The DTD handler.
See Also: AbstractSAXParser
Parameters: resolver The new entity resolver. Passing a null value will uninstall the currently installed resolver.
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.
Parameters: errorHandler The error handler.
See Also: AbstractSAXParser
Parameters: featureId The unique identifier (URI) of the feature. state The requested state of the feature (true or false).
Throws: SAXNotRecognizedException If the requested feature is not known. SAXNotSupportedException If the requested feature is known, but the requested state is not supported.
This method is the equivalent to the property:
http://xml.org/sax/properties/lexical-handler
Parameters: handler lexical event handler
See Also: AbstractSAXParser AbstractSAXParser
Parameters: locale The locale object to use for localization of messages.
Throws: SAXException An exception thrown if the parser does not support the specified locale.
See Also: org.xml.sax.Parser
Parameters: propertyId The unique identifier (URI) of the property being set. value The value to which the property is being set.
Throws: SAXNotRecognizedException If the requested property is not known. SAXNotSupportedException If the requested property is known, but the requested value is not supported.
Parameters: augs Additional information that may include infoset augmentations
Throws: XNIException Thrown by handler to signal an error.
Parameters: locator 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 augmentations
Throws: XNIException Thrown by handler to signal an error.
Parameters: element The name of the element. attributes The element attributes. augs Additional information that may include infoset augmentations
Throws: XNIException Thrown by handler to signal an error.
Parameters: augs Additional information that may include infoset augmentations.
Throws: XNIException Thrown by handler to signal an error.
Note: Since the document is an entity, the handler will be notified of the start of the document entity by calling the startEntity method with the entity name "[xml]" before calling the startDocument method. When exposing entity boundaries through the SAX API, the document entity is never reported, however.
Note: This method is not called for entity references appearing as part of attribute values.
Parameters: name The name of the entity. identifier The resource identifier. 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 parameter entities). augs Additional information that may include infoset augmentations
Throws: XNIException Thrown by handler to signal an error.
Note: Since the document is an entity, the handler will be notified of the start of the document entity by calling the startEntity method with the entity name "[xml]" before calling the startDocument method. When exposing entity boundaries through the SAX API, the document entity is never reported, however.
Note: This method is not called for entity references appearing as part of attribute values.
Parameters: name The name of the parameter entity. identifier The resource identifier. 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 parameter entities). augs Additional information that may include infoset augmentations.
Throws: XNIException Thrown by handler to signal an error.
Parameters: name The name of the entity. identifier An object containing all location information pertinent to this entity. notation The name of the notation. augs Additional information that may include infoset augmentations.
Throws: XNIException Thrown by handler to signal an error.
Parameters: version 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 augmentations
Throws: XNIException Thrown by handler to signal an error.