- java.lang.Object
-
- com.sun.xml.fastinfoset.Decoder
-
- com.sun.xml.fastinfoset.sax.SAXDocumentParser
-
- All Implemented Interfaces:
FastInfosetParser
,FastInfosetReader
,org.xml.sax.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 Modifier and Type Class Description private static class
SAXDocumentParser.DeclHandlerImpl
private static class
SAXDocumentParser.LexicalHandlerImpl
-
Nested classes/interfaces inherited from class com.sun.xml.fastinfoset.Decoder
Decoder.EncodingAlgorithmInputStream
-
-
Field Summary
Fields Modifier and Type Field Description protected EncodingAlgorithmContentHandler
_algorithmHandler
protected AttributesHolder
_attributes
protected boolean
_clearAttributes
protected org.xml.sax.ContentHandler
_contentHandler
Reference to content handler.protected org.xml.sax.ext.DeclHandler
_declHandler
Reference to DTD declaration handler.protected org.xml.sax.DTDHandler
_dtdHandler
Reference to dtd handler.protected org.xml.sax.EntityResolver
_entityResolver
Reference to entity resolver.protected org.xml.sax.ErrorHandler
_errorHandler
Reference to error handler.protected org.xml.sax.ext.LexicalHandler
_lexicalHandler
Reference to lexical handler.protected int[]
_namespacePrefixes
protected boolean
_namespacePrefixesFeature
SAX Namespace attributes featuresprotected int
_namespacePrefixesIndex
protected PrimitiveTypeContentHandler
_primitiveHandler
protected BuiltInEncodingAlgorithmState
builtInAlgorithmState
private static java.util.logging.Logger
logger
-
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 Deprecated Methods Modifier and Type Method Description org.xml.sax.ContentHandler
getContentHandler()
org.xml.sax.ext.DeclHandler
getDeclHandler()
Return the current DTD declaration handler.org.xml.sax.DTDHandler
getDTDHandler()
EncodingAlgorithmContentHandler
getEncodingAlgorithmContentHandler()
Return the current encoding algorithm handler.org.xml.sax.EntityResolver
getEntityResolver()
org.xml.sax.ErrorHandler
getErrorHandler()
boolean
getFeature(java.lang.String name)
org.xml.sax.ext.LexicalHandler
getLexicalHandler()
Return the current lexical handler.PrimitiveTypeContentHandler
getPrimitiveTypeContentHandler()
Return the current primitive type handler.java.lang.Object
getProperty(java.lang.String name)
void
parse()
void
parse(java.io.InputStream s)
Parse a fast infoset document from an InputStream.void
parse(java.lang.String systemId)
void
parse(org.xml.sax.InputSource input)
protected void
processAIIEncodingAlgorithm(QualifiedName name, boolean addToTable)
protected void
processAIIs()
protected void
processBuiltInEncodingAlgorithmAsCharacters(java.lang.StringBuffer buffer)
Deprecated, for removal: This API element is subject to removal in a future version.protected void
processBuiltInEncodingAlgorithmAsCharacters(java.lang.StringBuilder buffer)
protected java.lang.Object
processBuiltInEncodingAlgorithmAsObject()
protected void
processCIIBuiltInEncodingAlgorithmAsPrimitive()
protected void
processCIIEncodingAlgorithm(boolean addToTable)
protected void
processCommentII()
protected void
processDII()
protected void
processDIIFragment()
protected void
processDIIOptionalProperties()
protected void
processEII(QualifiedName name, boolean hasAttributes)
protected void
processEIIWithNamespaces()
protected void
processProcessingII()
private void
processUtf8CharacterString()
protected void
resetOnError()
void
setContentHandler(org.xml.sax.ContentHandler handler)
void
setDeclHandler(org.xml.sax.ext.DeclHandler handler)
Allow an application to register a DTD declaration handler.void
setDTDHandler(org.xml.sax.DTDHandler handler)
void
setEncodingAlgorithmContentHandler(EncodingAlgorithmContentHandler handler)
Allow an application to register an encoding algorithm handler.void
setEntityResolver(org.xml.sax.EntityResolver resolver)
void
setErrorHandler(org.xml.sax.ErrorHandler handler)
void
setFeature(java.lang.String name, boolean value)
void
setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)
Allow an application to register a lexical handler.void
setPrimitiveTypeContentHandler(PrimitiveTypeContentHandler handler)
Allow an application to register a primitive type handler.void
setProperty(java.lang.String name, java.lang.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
-
logger
private static final java.util.logging.Logger logger
-
_namespacePrefixesFeature
protected boolean _namespacePrefixesFeature
SAX Namespace attributes features
-
_entityResolver
protected org.xml.sax.EntityResolver _entityResolver
Reference to entity resolver.
-
_dtdHandler
protected org.xml.sax.DTDHandler _dtdHandler
Reference to dtd handler.
-
_contentHandler
protected org.xml.sax.ContentHandler _contentHandler
Reference to content handler.
-
_errorHandler
protected org.xml.sax.ErrorHandler _errorHandler
Reference to error handler.
-
_lexicalHandler
protected org.xml.sax.ext.LexicalHandler _lexicalHandler
Reference to lexical handler.
-
_declHandler
protected org.xml.sax.ext.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(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
- Specified by:
getFeature
in interfaceorg.xml.sax.XMLReader
- Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
-
setFeature
public void setFeature(java.lang.String name, boolean value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
- Specified by:
setFeature
in interfaceorg.xml.sax.XMLReader
- Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
-
getProperty
public java.lang.Object getProperty(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
- Specified by:
getProperty
in interfaceorg.xml.sax.XMLReader
- Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
-
setProperty
public void setProperty(java.lang.String name, java.lang.Object value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedException
- Specified by:
setProperty
in interfaceorg.xml.sax.XMLReader
- Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
-
setEntityResolver
public void setEntityResolver(org.xml.sax.EntityResolver resolver)
- Specified by:
setEntityResolver
in interfaceorg.xml.sax.XMLReader
-
getEntityResolver
public org.xml.sax.EntityResolver getEntityResolver()
- Specified by:
getEntityResolver
in interfaceorg.xml.sax.XMLReader
-
setDTDHandler
public void setDTDHandler(org.xml.sax.DTDHandler handler)
- Specified by:
setDTDHandler
in interfaceorg.xml.sax.XMLReader
-
getDTDHandler
public org.xml.sax.DTDHandler getDTDHandler()
- Specified by:
getDTDHandler
in interfaceorg.xml.sax.XMLReader
-
setContentHandler
public void setContentHandler(org.xml.sax.ContentHandler handler)
- Specified by:
setContentHandler
in interfaceorg.xml.sax.XMLReader
-
getContentHandler
public org.xml.sax.ContentHandler getContentHandler()
- Specified by:
getContentHandler
in interfaceorg.xml.sax.XMLReader
-
setErrorHandler
public void setErrorHandler(org.xml.sax.ErrorHandler handler)
- Specified by:
setErrorHandler
in interfaceorg.xml.sax.XMLReader
-
getErrorHandler
public org.xml.sax.ErrorHandler getErrorHandler()
- Specified by:
getErrorHandler
in interfaceorg.xml.sax.XMLReader
-
parse
public void parse(org.xml.sax.InputSource input) throws java.io.IOException, org.xml.sax.SAXException
- Specified by:
parse
in interfaceorg.xml.sax.XMLReader
- Throws:
java.io.IOException
org.xml.sax.SAXException
-
parse
public void parse(java.lang.String systemId) throws java.io.IOException, org.xml.sax.SAXException
- Specified by:
parse
in interfaceorg.xml.sax.XMLReader
- Throws:
java.io.IOException
org.xml.sax.SAXException
-
parse
public final void parse(java.io.InputStream s) throws java.io.IOException, FastInfosetException, org.xml.sax.SAXException
Description copied from interface:FastInfosetReader
Parse 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:
parse
in interfaceFastInfosetReader
- Parameters:
s
- The byte stream to parse from.- Throws:
java.io.IOException
FastInfosetException
org.xml.sax.SAXException
-
setLexicalHandler
public void setLexicalHandler(org.xml.sax.ext.LexicalHandler handler)
Description copied from interface:FastInfosetReader
Allow 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:
setLexicalHandler
in interfaceFastInfosetReader
- Parameters:
handler
- The lexical handler.- See Also:
FastInfosetReader.getLexicalHandler()
-
getLexicalHandler
public org.xml.sax.ext.LexicalHandler getLexicalHandler()
Description copied from interface:FastInfosetReader
Return the current lexical handler.- Specified by:
getLexicalHandler
in 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(org.xml.sax.ext.DeclHandler handler)
Description copied from interface:FastInfosetReader
Allow 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:
setDeclHandler
in interfaceFastInfosetReader
- Parameters:
handler
- The DTD declaration handler.- See Also:
FastInfosetReader.getLexicalHandler()
-
getDeclHandler
public org.xml.sax.ext.DeclHandler getDeclHandler()
Description copied from interface:FastInfosetReader
Return the current DTD declaration handler.- Specified by:
getDeclHandler
in 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:FastInfosetReader
Allow 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:
setEncodingAlgorithmContentHandler
in interfaceFastInfosetReader
- Parameters:
handler
- The encoding algorithm handler.- See Also:
FastInfosetReader.getEncodingAlgorithmContentHandler()
-
getEncodingAlgorithmContentHandler
public EncodingAlgorithmContentHandler getEncodingAlgorithmContentHandler()
Description copied from interface:FastInfosetReader
Return the current encoding algorithm handler.- Specified by:
getEncodingAlgorithmContentHandler
in 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:FastInfosetReader
Allow 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:
setPrimitiveTypeContentHandler
in interfaceFastInfosetReader
- Parameters:
handler
- The primitive type handler.- See Also:
FastInfosetReader.getPrimitiveTypeContentHandler()
-
getPrimitiveTypeContentHandler
public PrimitiveTypeContentHandler getPrimitiveTypeContentHandler()
Description copied from interface:FastInfosetReader
Return the current primitive type handler.- Specified by:
getPrimitiveTypeContentHandler
in 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, java.io.IOException
- Throws:
FastInfosetException
java.io.IOException
-
processDII
protected final void processDII() throws FastInfosetException, java.io.IOException
- Throws:
FastInfosetException
java.io.IOException
-
processDIIFragment
protected final void processDIIFragment() throws FastInfosetException, java.io.IOException
- Throws:
FastInfosetException
java.io.IOException
-
processDIIOptionalProperties
protected final void processDIIOptionalProperties() throws FastInfosetException, java.io.IOException
- Throws:
FastInfosetException
java.io.IOException
-
processEII
protected final void processEII(QualifiedName name, boolean hasAttributes) throws FastInfosetException, java.io.IOException
- Throws:
FastInfosetException
java.io.IOException
-
processUtf8CharacterString
private void processUtf8CharacterString() throws FastInfosetException, java.io.IOException
- Throws:
FastInfosetException
java.io.IOException
-
processEIIWithNamespaces
protected final void processEIIWithNamespaces() throws FastInfosetException, java.io.IOException
- Throws:
FastInfosetException
java.io.IOException
-
processAIIs
protected final void processAIIs() throws FastInfosetException, java.io.IOException
- Throws:
FastInfosetException
java.io.IOException
-
processCommentII
protected final void processCommentII() throws FastInfosetException, java.io.IOException
- Throws:
FastInfosetException
java.io.IOException
-
processProcessingII
protected final void processProcessingII() throws FastInfosetException, java.io.IOException
- Throws:
FastInfosetException
java.io.IOException
-
processCIIEncodingAlgorithm
protected final void processCIIEncodingAlgorithm(boolean addToTable) throws FastInfosetException, java.io.IOException
- Throws:
FastInfosetException
java.io.IOException
-
processCIIBuiltInEncodingAlgorithmAsPrimitive
protected final void processCIIBuiltInEncodingAlgorithmAsPrimitive() throws FastInfosetException, java.io.IOException
- Throws:
FastInfosetException
java.io.IOException
-
processAIIEncodingAlgorithm
protected final void processAIIEncodingAlgorithm(QualifiedName name, boolean addToTable) throws FastInfosetException, java.io.IOException
- Throws:
FastInfosetException
java.io.IOException
-
processBuiltInEncodingAlgorithmAsCharacters
protected final void processBuiltInEncodingAlgorithmAsCharacters(java.lang.StringBuilder buffer) throws FastInfosetException, java.io.IOException
- Throws:
FastInfosetException
java.io.IOException
-
processBuiltInEncodingAlgorithmAsCharacters
@Deprecated(since="2.1.1", forRemoval=true) protected final void processBuiltInEncodingAlgorithmAsCharacters(java.lang.StringBuffer buffer) throws FastInfosetException, java.io.IOException
Deprecated, for removal: This API element is subject to removal in a future version.- Throws:
FastInfosetException
java.io.IOException
-
processBuiltInEncodingAlgorithmAsObject
protected final java.lang.Object processBuiltInEncodingAlgorithmAsObject() throws FastInfosetException, java.io.IOException
- Throws:
FastInfosetException
java.io.IOException
-
-