Class SAXDocumentParser
- java.lang.Object
-
- com.sun.xml.fastinfoset.Decoder
-
- com.sun.xml.fastinfoset.sax.SAXDocumentParser
-
- All Implemented Interfaces:
FastInfosetParser,FastInfosetReader,XMLReader
public class SAXDocumentParser extends Decoder implements FastInfosetReader
The Fast Infoset SAX parser.Instantiate this parser to parse a fast infoset document in accordance with the SAX API.
More than one fast infoset document may be decoded from the
InputStream.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.sun.xml.fastinfoset.Decoder
Decoder.EncodingAlgorithmInputStream
-
-
Field Summary
Fields Modifier and Type Field Description protected EncodingAlgorithmContentHandler_algorithmHandlerprotected AttributesHolder_attributesprotected boolean_clearAttributesprotected ContentHandler_contentHandlerReference to content handler.protected DeclHandler_declHandlerReference to DTD declaration handler.protected DTDHandler_dtdHandlerReference to dtd handler.protected EntityResolver_entityResolverReference to entity resolver.protected ErrorHandler_errorHandlerReference to error handler.protected LexicalHandler_lexicalHandlerReference to lexical handler.protected int[]_namespacePrefixesprotected boolean_namespacePrefixesFeatureSAX Namespace attributes featuresprotected int_namespacePrefixesIndexprotected PrimitiveTypeContentHandler_primitiveHandlerprotected BuiltInEncodingAlgorithmStatebuiltInAlgorithmState-
Fields inherited from class com.sun.xml.fastinfoset.Decoder
_addToTable, _attributeNameTable, _attributeValueTable, _b, _bufferSize, _characterContentChunkTable, _charBuffer, _charBufferLength, _doubleTerminate, _duplicateAttributeVerifier, _elementNameTable, _identifier, _integer, _namespaceNameIndex, _needForceStreamClose, _notations, _octetBuffer, _octetBufferEnd, _octetBufferLength, _octetBufferOffset, _octetBufferStart, _parseFragments, _prefixIndex, _prefixTable, _registeredEncodingAlgorithms, _terminate, _unparsedEntities, _v, BUFFER_SIZE_SYSTEM_PROPERTY, NISTRING_EMPTY_STRING, NISTRING_ENCODING_ALGORITHM, NISTRING_INDEX, NISTRING_STRING, STRING_INTERNING_SYSTEM_PROPERTY
-
Fields inherited from interface org.jvnet.fastinfoset.FastInfosetParser
BUFFER_SIZE_PROPERTY, EXTERNAL_VOCABULARIES_PROPERTY, FORCE_STREAM_CLOSE_PROPERTY, REGISTERED_ENCODING_ALGORITHMS_PROPERTY, STRING_INTERNING_PROPERTY
-
Fields inherited from interface org.jvnet.fastinfoset.sax.FastInfosetReader
ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY, PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY
-
-
Constructor Summary
Constructors Constructor Description SAXDocumentParser()Creates a new instance of DocumetParser2
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContentHandlergetContentHandler()DeclHandlergetDeclHandler()Return the current DTD declaration handler.DTDHandlergetDTDHandler()EncodingAlgorithmContentHandlergetEncodingAlgorithmContentHandler()Return the current encoding algorithm handler.EntityResolvergetEntityResolver()ErrorHandlergetErrorHandler()booleangetFeature(String name)LexicalHandlergetLexicalHandler()Return the current lexical handler.PrimitiveTypeContentHandlergetPrimitiveTypeContentHandler()Return the current primitive type handler.ObjectgetProperty(String name)voidparse()voidparse(InputStream s)Parse a fast infoset document from an InputStream.voidparse(String systemId)voidparse(InputSource input)protected voidprocessAIIEncodingAlgorithm(QualifiedName name, boolean addToTable)protected voidprocessAIIs()protected voidprocessBuiltInEncodingAlgorithmAsCharacters(StringBuffer buffer)protected ObjectprocessBuiltInEncodingAlgorithmAsObject()protected voidprocessCIIBuiltInEncodingAlgorithmAsPrimitive()protected voidprocessCIIEncodingAlgorithm(boolean addToTable)protected voidprocessCommentII()protected voidprocessDII()protected voidprocessDIIFragment()protected voidprocessDIIOptionalProperties()protected voidprocessEII(QualifiedName name, boolean hasAttributes)protected voidprocessEIIWithNamespaces()protected voidprocessProcessingII()protected voidresetOnError()voidsetContentHandler(ContentHandler handler)voidsetDeclHandler(DeclHandler handler)Allow an application to register a DTD declaration handler.voidsetDTDHandler(DTDHandler handler)voidsetEncodingAlgorithmContentHandler(EncodingAlgorithmContentHandler handler)Allow an application to register an encoding algorithm handler.voidsetEntityResolver(EntityResolver resolver)voidsetErrorHandler(ErrorHandler handler)voidsetFeature(String name, boolean value)voidsetLexicalHandler(LexicalHandler handler)Allow an application to register a lexical handler.voidsetPrimitiveTypeContentHandler(PrimitiveTypeContentHandler handler)Allow an application to register a primitive type handler.voidsetProperty(String name, Object value)-
Methods inherited from class com.sun.xml.fastinfoset.Decoder
_isFastInfosetDocument, closeIfRequired, createQualifiedNameString, createQualifiedNameString, decodeAdditionalData, decodeAlphabetOctetsAsCharBuffer, decodeCharacterEncodingScheme, decodeDII, decodeEIIIndexLarge, decodeEIIIndexMedium, decodeFourBitAlphabetOctetsAsCharBuffer, decodeHeader, decodeIdentifyingNonEmptyStringIndexOnFirstBitAsNamespaceName, decodeIdentifyingNonEmptyStringIndexOnFirstBitAsPrefix, decodeIdentifyingNonEmptyStringOnFirstBit, decodeIdentifyingNonEmptyStringOnFirstBitAsNamespaceName, decodeIdentifyingNonEmptyStringOnFirstBitAsPrefix, decodeInitialVocabulary, decodeIntegerIndexOnSecondBit, decodeLiteralQualifiedName, decodeNonEmptyOctetStringLengthOnSecondBit, decodeNonEmptyOctetStringOnSecondBitAsUtf8CharArray, decodeNonEmptyOctetStringOnSecondBitAsUtf8String, decodeNonIdentifyingStringOnFirstBit, decodeNotations, decodeOctetsOnFifthBitOfNonIdentifyingStringOnFirstBit, decodeOctetsOnSeventhBitOfNonIdentifyingStringOnThirdBit, decodeRAOctetsAsString, decodeRestrictedAlphabetAsCharBuffer, decodeRestrictedAlphabetAsString, decodeUnparsedEntities, decodeUtf16StringAsCharBuffer, decodeUtf16StringAsString, decodeUtf8NCNameIntoCharBuffer, decodeUtf8StringAsCharBuffer, decodeUtf8StringAsCharBuffer, decodeUtf8StringAsString, decodeUtf8StringIntoCharBuffer, decodeUtf8StringIntoCharBuffer, decodeVersion, getBufferSize, getExternalVocabularies, getForceStreamClose, getParseFragments, getRegisteredEncodingAlgorithms, getStringInterning, isFastInfosetDocument, peek, peek, peek2, read, reset, setBufferSize, setExternalVocabularies, setForceStreamClose, setInputStream, setParseFragments, setRegisteredEncodingAlgorithms, setStringInterning, setVocabulary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jvnet.fastinfoset.FastInfosetParser
getBufferSize, getExternalVocabularies, getForceStreamClose, getParseFragments, getRegisteredEncodingAlgorithms, getStringInterning, setBufferSize, setExternalVocabularies, setForceStreamClose, setParseFragments, setRegisteredEncodingAlgorithms, setStringInterning
-
-
-
-
Field Detail
-
_namespacePrefixesFeature
protected boolean _namespacePrefixesFeature
SAX Namespace attributes features
-
_entityResolver
protected EntityResolver _entityResolver
Reference to entity resolver.
-
_dtdHandler
protected DTDHandler _dtdHandler
Reference to dtd handler.
-
_contentHandler
protected ContentHandler _contentHandler
Reference to content handler.
-
_errorHandler
protected ErrorHandler _errorHandler
Reference to error handler.
-
_lexicalHandler
protected LexicalHandler _lexicalHandler
Reference to lexical handler.
-
_declHandler
protected DeclHandler _declHandler
Reference to DTD declaration handler.
-
_algorithmHandler
protected EncodingAlgorithmContentHandler _algorithmHandler
-
_primitiveHandler
protected PrimitiveTypeContentHandler _primitiveHandler
-
builtInAlgorithmState
protected BuiltInEncodingAlgorithmState builtInAlgorithmState
-
_attributes
protected AttributesHolder _attributes
-
_namespacePrefixes
protected int[] _namespacePrefixes
-
_namespacePrefixesIndex
protected int _namespacePrefixesIndex
-
_clearAttributes
protected boolean _clearAttributes
-
-
Method Detail
-
resetOnError
protected void resetOnError()
-
getFeature
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException
- Specified by:
getFeaturein interfaceXMLReader- Throws:
SAXNotRecognizedExceptionSAXNotSupportedException
-
setFeature
public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException
- Specified by:
setFeaturein interfaceXMLReader- Throws:
SAXNotRecognizedExceptionSAXNotSupportedException
-
getProperty
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException
- Specified by:
getPropertyin interfaceXMLReader- Throws:
SAXNotRecognizedExceptionSAXNotSupportedException
-
setProperty
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException
- Specified by:
setPropertyin interfaceXMLReader- Throws:
SAXNotRecognizedExceptionSAXNotSupportedException
-
setEntityResolver
public void setEntityResolver(EntityResolver resolver)
- Specified by:
setEntityResolverin interfaceXMLReader
-
getEntityResolver
public EntityResolver getEntityResolver()
- Specified by:
getEntityResolverin interfaceXMLReader
-
setDTDHandler
public void setDTDHandler(DTDHandler handler)
- Specified by:
setDTDHandlerin interfaceXMLReader
-
getDTDHandler
public DTDHandler getDTDHandler()
- Specified by:
getDTDHandlerin interfaceXMLReader
-
setContentHandler
public void setContentHandler(ContentHandler handler)
- Specified by:
setContentHandlerin interfaceXMLReader
-
getContentHandler
public ContentHandler getContentHandler()
- Specified by:
getContentHandlerin interfaceXMLReader
-
setErrorHandler
public void setErrorHandler(ErrorHandler handler)
- Specified by:
setErrorHandlerin interfaceXMLReader
-
getErrorHandler
public ErrorHandler getErrorHandler()
- Specified by:
getErrorHandlerin interfaceXMLReader
-
parse
public void parse(InputSource input) throws IOException, SAXException
- Specified by:
parsein interfaceXMLReader- Throws:
IOExceptionSAXException
-
parse
public void parse(String systemId) throws IOException, SAXException
- Specified by:
parsein interfaceXMLReader- Throws:
IOExceptionSAXException
-
parse
public final void parse(InputStream s) throws IOException, FastInfosetException, SAXException
Description copied from interface:FastInfosetReaderParse a fast infoset document from an InputStream.The application can use this method to instruct the Fast Infoset reader to begin parsing a fast infoset document from a byte stream.
Applications may not invoke this method while a parse is in progress (they should create a new XMLReader instead for each nested XML document). Once a parse is complete, an application may reuse the same FastInfosetReader object, possibly with a different byte stream.
During the parse, the FastInfosetReader will provide information about the fast infoset document through the registered event handlers.
This method is synchronous: it will not return until parsing has ended. If a client application wants to terminate parsing early, it should throw an exception.
- Specified by:
parsein interfaceFastInfosetReader- Parameters:
s- The byte stream to parse from.- Throws:
IOExceptionFastInfosetExceptionSAXException
-
setLexicalHandler
public void setLexicalHandler(LexicalHandler handler)
Description copied from interface:FastInfosetReaderAllow an application to register a lexical handler.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.
- Specified by:
setLexicalHandlerin interfaceFastInfosetReader- Parameters:
handler- The lexical handler.- See Also:
FastInfosetReader.getLexicalHandler()
-
getLexicalHandler
public LexicalHandler getLexicalHandler()
Description copied from interface:FastInfosetReaderReturn the current lexical handler.- Specified by:
getLexicalHandlerin interfaceFastInfosetReader- Returns:
- The current lexical handler, or null if none has been registered.
- See Also:
FastInfosetReader.setLexicalHandler(org.xml.sax.ext.LexicalHandler)
-
setDeclHandler
public void setDeclHandler(DeclHandler handler)
Description copied from interface:FastInfosetReaderAllow an application to register a DTD declaration handler.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.
- Specified by:
setDeclHandlerin interfaceFastInfosetReader- Parameters:
handler- The DTD declaration handler.- See Also:
FastInfosetReader.getLexicalHandler()
-
getDeclHandler
public DeclHandler getDeclHandler()
Description copied from interface:FastInfosetReaderReturn the current DTD declaration handler.- Specified by:
getDeclHandlerin interfaceFastInfosetReader- Returns:
- The current DTD declaration handler, or null if none has been registered.
- See Also:
FastInfosetReader.setLexicalHandler(org.xml.sax.ext.LexicalHandler)
-
setEncodingAlgorithmContentHandler
public void setEncodingAlgorithmContentHandler(EncodingAlgorithmContentHandler handler)
Description copied from interface:FastInfosetReaderAllow an application to register an encoding algorithm handler.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.
- Specified by:
setEncodingAlgorithmContentHandlerin interfaceFastInfosetReader- Parameters:
handler- The encoding algorithm handler.- See Also:
FastInfosetReader.getEncodingAlgorithmContentHandler()
-
getEncodingAlgorithmContentHandler
public EncodingAlgorithmContentHandler getEncodingAlgorithmContentHandler()
Description copied from interface:FastInfosetReaderReturn the current encoding algorithm handler.- Specified by:
getEncodingAlgorithmContentHandlerin interfaceFastInfosetReader- Returns:
- The current encoding algorithm handler, or null if none has been registered.
- See Also:
FastInfosetReader.setEncodingAlgorithmContentHandler(org.jvnet.fastinfoset.sax.EncodingAlgorithmContentHandler)
-
setPrimitiveTypeContentHandler
public void setPrimitiveTypeContentHandler(PrimitiveTypeContentHandler handler)
Description copied from interface:FastInfosetReaderAllow an application to register a primitive type handler.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.
- Specified by:
setPrimitiveTypeContentHandlerin interfaceFastInfosetReader- Parameters:
handler- The primitive type handler.- See Also:
FastInfosetReader.getPrimitiveTypeContentHandler()
-
getPrimitiveTypeContentHandler
public PrimitiveTypeContentHandler getPrimitiveTypeContentHandler()
Description copied from interface:FastInfosetReaderReturn the current primitive type handler.- Specified by:
getPrimitiveTypeContentHandlerin interfaceFastInfosetReader- Returns:
- The current primitive type handler, or null if none has been registered.
- See Also:
FastInfosetReader.setPrimitiveTypeContentHandler(org.jvnet.fastinfoset.sax.PrimitiveTypeContentHandler)
-
parse
public final void parse() throws FastInfosetException, IOException- Throws:
FastInfosetExceptionIOException
-
processDII
protected final void processDII() throws FastInfosetException, IOException- Throws:
FastInfosetExceptionIOException
-
processDIIFragment
protected final void processDIIFragment() throws FastInfosetException, IOException- Throws:
FastInfosetExceptionIOException
-
processDIIOptionalProperties
protected final void processDIIOptionalProperties() throws FastInfosetException, IOException- Throws:
FastInfosetExceptionIOException
-
processEII
protected final void processEII(QualifiedName name, boolean hasAttributes) throws FastInfosetException, IOException
- Throws:
FastInfosetExceptionIOException
-
processEIIWithNamespaces
protected final void processEIIWithNamespaces() throws FastInfosetException, IOException- Throws:
FastInfosetExceptionIOException
-
processAIIs
protected final void processAIIs() throws FastInfosetException, IOException- Throws:
FastInfosetExceptionIOException
-
processCommentII
protected final void processCommentII() throws FastInfosetException, IOException- Throws:
FastInfosetExceptionIOException
-
processProcessingII
protected final void processProcessingII() throws FastInfosetException, IOException- Throws:
FastInfosetExceptionIOException
-
processCIIEncodingAlgorithm
protected final void processCIIEncodingAlgorithm(boolean addToTable) throws FastInfosetException, IOException- Throws:
FastInfosetExceptionIOException
-
processCIIBuiltInEncodingAlgorithmAsPrimitive
protected final void processCIIBuiltInEncodingAlgorithmAsPrimitive() throws FastInfosetException, IOException- Throws:
FastInfosetExceptionIOException
-
processAIIEncodingAlgorithm
protected final void processAIIEncodingAlgorithm(QualifiedName name, boolean addToTable) throws FastInfosetException, IOException
- Throws:
FastInfosetExceptionIOException
-
processBuiltInEncodingAlgorithmAsCharacters
protected final void processBuiltInEncodingAlgorithmAsCharacters(StringBuffer buffer) throws FastInfosetException, IOException
- Throws:
FastInfosetExceptionIOException
-
processBuiltInEncodingAlgorithmAsObject
protected final Object processBuiltInEncodingAlgorithmAsObject() throws FastInfosetException, IOException
- Throws:
FastInfosetExceptionIOException
-
-