- java.lang.Object
-
- org.xbib.content.xml.stream.StaxEventXMLReader
-
- All Implemented Interfaces:
org.xml.sax.XMLReader
public class StaxEventXMLReader extends java.lang.ObjectSAXXMLReaderthat reads from a StAXXMLEventReader. ConsumesXMLEventsfrom anXMLEventReader, and calls the corresponding methods on the SAX callback interfaces.
-
-
Constructor Summary
Constructors Constructor Description StaxEventXMLReader(javax.xml.stream.XMLEventReader reader)Constructs a new instance of theStaxEventXmlReaderthat reads from the givenXMLEventReader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.xml.sax.ContentHandlergetContentHandler()org.xml.sax.DTDHandlergetDTDHandler()org.xml.sax.EntityResolvergetEntityResolver()org.xml.sax.ErrorHandlergetErrorHandler()booleangetFeature(java.lang.String name)Throws aSAXNotRecognizedExceptionexception.protected org.xml.sax.ext.LexicalHandlergetLexicalHandler()java.lang.ObjectgetProperty(java.lang.String name)Throws aSAXNotRecognizedExceptionexception when the given property does not signify a lexical handler.protected booleanhasNamespacePrefixesFeature()Indicates whether the SAX featurehttp://xml.org/sax/features/namespaces-prefixesis turned on.protected booleanhasNamespacesFeature()Indicates whether the SAX featurehttp://xml.org/sax/features/namespacesis turned on.voidparse(java.lang.String ignored)Parse the StAX XML reader passed at construction-time.voidparse(org.xml.sax.InputSource ignored)Parse the StAX XML reader passed at construction-time.protected voidparseInternal()Template-method that parses the StAX reader passed at construction-time.voidsetContentHandler(org.xml.sax.ContentHandler contentHandler)voidsetDTDHandler(org.xml.sax.DTDHandler dtdHandler)voidsetEntityResolver(org.xml.sax.EntityResolver entityResolver)voidsetErrorHandler(org.xml.sax.ErrorHandler errorHandler)voidsetFeature(java.lang.String name, boolean value)Throws aSAXNotRecognizedExceptionexception.protected voidsetLocator(javax.xml.stream.Location location)Sett the SAXLocatorbased on the given StAXLocation.voidsetProperty(java.lang.String name, java.lang.Object value)Throws aSAXNotRecognizedExceptionexception when the given property does not signify a lexical handler.protected voidsetStandalone(boolean standalone)protected java.lang.StringtoQualifiedName(javax.xml.namespace.QName qName)Convert aQNameto a qualified name, as used by DOM and SAX.
-
-
-
Constructor Detail
-
StaxEventXMLReader
public StaxEventXMLReader(javax.xml.stream.XMLEventReader reader)
Constructs a new instance of theStaxEventXmlReaderthat reads from the givenXMLEventReader. The supplied event reader must be inXMLStreamConstants.START_DOCUMENTorXMLStreamConstants.START_ELEMENTstate.- Parameters:
reader- theXMLEventReaderto read from- Throws:
java.lang.IllegalStateException- if the reader is not at the start of a document or element
-
-
Method Detail
-
parseInternal
protected void parseInternal() throws org.xml.sax.SAXException, javax.xml.stream.XMLStreamExceptionTemplate-method that parses the StAX reader passed at construction-time.- Throws:
org.xml.sax.SAXException- A SAX exception, possibly wrapping aXMLStreamExceptionjavax.xml.stream.XMLStreamException- if XML stream can not be processed
-
getFeature
public boolean getFeature(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionThrows aSAXNotRecognizedExceptionexception.- Specified by:
getFeaturein interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedException- alwaysorg.xml.sax.SAXNotSupportedException
-
setFeature
public void setFeature(java.lang.String name, boolean value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionThrows aSAXNotRecognizedExceptionexception.- Specified by:
setFeaturein interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedException- alwaysorg.xml.sax.SAXNotSupportedException
-
setStandalone
protected void setStandalone(boolean standalone)
-
hasNamespacesFeature
protected boolean hasNamespacesFeature()
Indicates whether the SAX featurehttp://xml.org/sax/features/namespacesis turned on.- Returns:
- true if namespaces are featured
-
hasNamespacePrefixesFeature
protected boolean hasNamespacePrefixesFeature()
Indicates whether the SAX featurehttp://xml.org/sax/features/namespaces-prefixesis turned on.- Returns:
- true if namespace prefixes are featured
-
setLocator
protected void setLocator(javax.xml.stream.Location location)
Sett the SAXLocatorbased on the given StAXLocation.- Parameters:
location- the location- See Also:
ContentHandler.setDocumentLocator(org.xml.sax.Locator)
-
toQualifiedName
protected java.lang.String toQualifiedName(javax.xml.namespace.QName qName)
Convert aQNameto a qualified name, as used by DOM and SAX. The returned string has a format ofprefix:localNameif the prefix is set, or justlocalNameif not.- Parameters:
qName- theQName- Returns:
- the qualified name
-
parse
public final void parse(org.xml.sax.InputSource ignored) throws org.xml.sax.SAXExceptionParse the StAX XML reader passed at construction-time.NOTE:: The given
InputSourceis not read, but ignored.- Parameters:
ignored- is ignored- Throws:
org.xml.sax.SAXException- a SAX exception, possibly wrapping aXMLStreamException
-
parse
public final void parse(java.lang.String ignored) throws org.xml.sax.SAXExceptionParse the StAX XML reader passed at construction-time.NOTE:: The given system identifier is not read, but ignored.
- Parameters:
ignored- is ignored- Throws:
org.xml.sax.SAXException- A SAX exception, possibly wrapping aXMLStreamException
-
getContentHandler
public org.xml.sax.ContentHandler getContentHandler()
- Specified by:
getContentHandlerin interfaceorg.xml.sax.XMLReader
-
setContentHandler
public void setContentHandler(org.xml.sax.ContentHandler contentHandler)
- Specified by:
setContentHandlerin interfaceorg.xml.sax.XMLReader
-
getDTDHandler
public org.xml.sax.DTDHandler getDTDHandler()
- Specified by:
getDTDHandlerin interfaceorg.xml.sax.XMLReader
-
setDTDHandler
public void setDTDHandler(org.xml.sax.DTDHandler dtdHandler)
- Specified by:
setDTDHandlerin interfaceorg.xml.sax.XMLReader
-
getEntityResolver
public org.xml.sax.EntityResolver getEntityResolver()
- Specified by:
getEntityResolverin interfaceorg.xml.sax.XMLReader
-
setEntityResolver
public void setEntityResolver(org.xml.sax.EntityResolver entityResolver)
- Specified by:
setEntityResolverin interfaceorg.xml.sax.XMLReader
-
getErrorHandler
public org.xml.sax.ErrorHandler getErrorHandler()
- Specified by:
getErrorHandlerin interfaceorg.xml.sax.XMLReader
-
setErrorHandler
public void setErrorHandler(org.xml.sax.ErrorHandler errorHandler)
- Specified by:
setErrorHandlerin interfaceorg.xml.sax.XMLReader
-
getLexicalHandler
protected org.xml.sax.ext.LexicalHandler getLexicalHandler()
-
getProperty
public java.lang.Object getProperty(java.lang.String name) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionThrows aSAXNotRecognizedExceptionexception when the given property does not signify a lexical handler. The property name for a lexical handler ishttp://xml.org/sax/properties/lexical-handler.- Specified by:
getPropertyin interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedExceptionorg.xml.sax.SAXNotSupportedException
-
setProperty
public void setProperty(java.lang.String name, java.lang.Object value) throws org.xml.sax.SAXNotRecognizedException, org.xml.sax.SAXNotSupportedExceptionThrows aSAXNotRecognizedExceptionexception when the given property does not signify a lexical handler. The property name for a lexical handler ishttp://xml.org/sax/properties/lexical-handler.- Specified by:
setPropertyin interfaceorg.xml.sax.XMLReader- Throws:
org.xml.sax.SAXNotRecognizedExceptionorg.xml.sax.SAXNotSupportedException
-
-