com.ctc.wstx.sax
Class WstxSAXParser

java.lang.Object
  extended by javax.xml.parsers.SAXParser
      extended by com.ctc.wstx.sax.WstxSAXParser
All Implemented Interfaces:
DTDEventListener, org.xml.sax.Attributes, org.xml.sax.ext.Attributes2, org.xml.sax.ext.Locator2, org.xml.sax.Locator, org.xml.sax.Parser, org.xml.sax.XMLReader

public class WstxSAXParser
extends javax.xml.parsers.SAXParser
implements org.xml.sax.Parser, org.xml.sax.XMLReader, org.xml.sax.ext.Attributes2, org.xml.sax.ext.Locator2, DTDEventListener

This class implements parser part of JAXP and SAX interfaces; and effectively offers an alternative to using Stax input factory / stream reader combination.


Field Summary
protected  org.xml.sax.ContentHandler mContentHandler
           
protected  org.xml.sax.DTDHandler mDTDHandler
           
 
Constructor Summary
WstxSAXParser()
           
 
Method Summary
 void attributeDecl(java.lang.String eName, java.lang.String aName, java.lang.String type, java.lang.String mode, java.lang.String value)
           
 void dtdComment(char[] data, int offset, int len)
           
 void dtdElementDecl(java.lang.String name, java.lang.String model)
           
 void dtdExternalEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
           
 void dtdInternalEntityDecl(java.lang.String name, java.lang.String value)
           
 void dtdNotationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.net.URL baseURL)
           
 void dtdProcessingInstruction(java.lang.String target, java.lang.String data)
           
 boolean dtdReportComments()
           
 void dtdSkippedEntity(java.lang.String name)
           
 void dtdUnparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName, java.net.URL baseURL)
           
 int getColumnNumber()
           
 org.xml.sax.ContentHandler getContentHandler()
           
 org.xml.sax.DTDHandler getDTDHandler()
           
 java.lang.String getEncoding()
           
 org.xml.sax.EntityResolver getEntityResolver()
           
 org.xml.sax.ErrorHandler getErrorHandler()
           
 boolean getFeature(java.lang.String name)
           
 int getIndex(java.lang.String qName)
           
 int getIndex(java.lang.String uri, java.lang.String localName)
           
 int getLength()
           
 int getLineNumber()
           
 java.lang.String getLocalName(int index)
           
 org.xml.sax.Parser getParser()
           
 java.lang.Object getProperty(java.lang.String name)
           
 java.lang.String getPublicId()
           
 java.lang.String getQName(int index)
           
 java.lang.String getSystemId()
           
 java.lang.String getType(int index)
           
 java.lang.String getType(java.lang.String qName)
           
 java.lang.String getType(java.lang.String uri, java.lang.String localName)
           
 java.lang.String getURI(int index)
           
 java.lang.String getValue(int index)
           
 java.lang.String getValue(java.lang.String qName)
           
 java.lang.String getValue(java.lang.String uri, java.lang.String localName)
           
 org.xml.sax.XMLReader getXMLReader()
           
 java.lang.String getXMLVersion()
           
 boolean isDeclared(int index)
           
 boolean isDeclared(java.lang.String qName)
           
 boolean isDeclared(java.lang.String uri, java.lang.String localName)
           
 boolean isNamespaceAware()
           
 boolean isSpecified(int index)
           
 boolean isSpecified(java.lang.String qName)
           
 boolean isSpecified(java.lang.String uri, java.lang.String localName)
           
 boolean isValidating()
           
 void parse(org.xml.sax.InputSource input)
           
 void parse(java.lang.String systemId)
           
 void setContentHandler(org.xml.sax.ContentHandler handler)
           
 void setDocumentHandler(org.xml.sax.DocumentHandler handler)
           
 void setDTDHandler(org.xml.sax.DTDHandler handler)
           
 void setEntityResolver(org.xml.sax.EntityResolver resolver)
           
 void setErrorHandler(org.xml.sax.ErrorHandler handler)
           
 void setFeature(java.lang.String name, boolean value)
           
 void setLocale(java.util.Locale locale)
           
 void setProperty(java.lang.String name, java.lang.Object value)
           
 
Methods inherited from class javax.xml.parsers.SAXParser
getSchema, isXIncludeAware, parse, parse, parse, parse, parse, parse, parse, parse, parse, parse, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mContentHandler

protected org.xml.sax.ContentHandler mContentHandler

mDTDHandler

protected org.xml.sax.DTDHandler mDTDHandler
Constructor Detail

WstxSAXParser

public WstxSAXParser()
Method Detail

getParser

public final org.xml.sax.Parser getParser()
Specified by:
getParser in class javax.xml.parsers.SAXParser

getXMLReader

public final org.xml.sax.XMLReader getXMLReader()
Specified by:
getXMLReader in class javax.xml.parsers.SAXParser

isNamespaceAware

public boolean isNamespaceAware()
Specified by:
isNamespaceAware in class javax.xml.parsers.SAXParser

isValidating

public boolean isValidating()
Specified by:
isValidating in class javax.xml.parsers.SAXParser

getProperty

public java.lang.Object getProperty(java.lang.String name)
                             throws org.xml.sax.SAXNotRecognizedException,
                                    org.xml.sax.SAXNotSupportedException
Specified by:
getProperty in interface org.xml.sax.XMLReader
Specified by:
getProperty in class javax.xml.parsers.SAXParser
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 interface org.xml.sax.XMLReader
Specified by:
setProperty in class javax.xml.parsers.SAXParser
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

getContentHandler

public org.xml.sax.ContentHandler getContentHandler()
Specified by:
getContentHandler in interface org.xml.sax.XMLReader

getDTDHandler

public org.xml.sax.DTDHandler getDTDHandler()
Specified by:
getDTDHandler in interface org.xml.sax.XMLReader

getEntityResolver

public org.xml.sax.EntityResolver getEntityResolver()
Specified by:
getEntityResolver in interface org.xml.sax.XMLReader

getErrorHandler

public org.xml.sax.ErrorHandler getErrorHandler()
Specified by:
getErrorHandler in interface org.xml.sax.XMLReader

getFeature

public boolean getFeature(java.lang.String name)
                   throws org.xml.sax.SAXNotRecognizedException
Specified by:
getFeature in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException

setContentHandler

public void setContentHandler(org.xml.sax.ContentHandler handler)
Specified by:
setContentHandler in interface org.xml.sax.XMLReader

setDTDHandler

public void setDTDHandler(org.xml.sax.DTDHandler handler)
Specified by:
setDTDHandler in interface org.xml.sax.Parser
Specified by:
setDTDHandler in interface org.xml.sax.XMLReader

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver resolver)
Specified by:
setEntityResolver in interface org.xml.sax.Parser
Specified by:
setEntityResolver in interface org.xml.sax.XMLReader

setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler handler)
Specified by:
setErrorHandler in interface org.xml.sax.Parser
Specified by:
setErrorHandler in interface org.xml.sax.XMLReader

setFeature

public void setFeature(java.lang.String name,
                       boolean value)
                throws org.xml.sax.SAXNotRecognizedException,
                       org.xml.sax.SAXNotSupportedException
Specified by:
setFeature in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException

parse

public void parse(org.xml.sax.InputSource input)
           throws org.xml.sax.SAXException
Specified by:
parse in interface org.xml.sax.Parser
Specified by:
parse in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXException

parse

public void parse(java.lang.String systemId)
           throws org.xml.sax.SAXException
Specified by:
parse in interface org.xml.sax.Parser
Specified by:
parse in interface org.xml.sax.XMLReader
Throws:
org.xml.sax.SAXException

setDocumentHandler

public void setDocumentHandler(org.xml.sax.DocumentHandler handler)
Specified by:
setDocumentHandler in interface org.xml.sax.Parser

setLocale

public void setLocale(java.util.Locale locale)
Specified by:
setLocale in interface org.xml.sax.Parser

getIndex

public int getIndex(java.lang.String qName)
Specified by:
getIndex in interface org.xml.sax.Attributes

getIndex

public int getIndex(java.lang.String uri,
                    java.lang.String localName)
Specified by:
getIndex in interface org.xml.sax.Attributes

getLength

public int getLength()
Specified by:
getLength in interface org.xml.sax.Attributes

getLocalName

public java.lang.String getLocalName(int index)
Specified by:
getLocalName in interface org.xml.sax.Attributes

getQName

public java.lang.String getQName(int index)
Specified by:
getQName in interface org.xml.sax.Attributes

getType

public java.lang.String getType(int index)
Specified by:
getType in interface org.xml.sax.Attributes

getType

public java.lang.String getType(java.lang.String qName)
Specified by:
getType in interface org.xml.sax.Attributes

getType

public java.lang.String getType(java.lang.String uri,
                                java.lang.String localName)
Specified by:
getType in interface org.xml.sax.Attributes

getURI

public java.lang.String getURI(int index)
Specified by:
getURI in interface org.xml.sax.Attributes

getValue

public java.lang.String getValue(int index)
Specified by:
getValue in interface org.xml.sax.Attributes

getValue

public java.lang.String getValue(java.lang.String qName)
Specified by:
getValue in interface org.xml.sax.Attributes

getValue

public java.lang.String getValue(java.lang.String uri,
                                 java.lang.String localName)
Specified by:
getValue in interface org.xml.sax.Attributes

isDeclared

public boolean isDeclared(int index)
Specified by:
isDeclared in interface org.xml.sax.ext.Attributes2

isDeclared

public boolean isDeclared(java.lang.String qName)
Specified by:
isDeclared in interface org.xml.sax.ext.Attributes2

isDeclared

public boolean isDeclared(java.lang.String uri,
                          java.lang.String localName)
Specified by:
isDeclared in interface org.xml.sax.ext.Attributes2

isSpecified

public boolean isSpecified(int index)
Specified by:
isSpecified in interface org.xml.sax.ext.Attributes2

isSpecified

public boolean isSpecified(java.lang.String qName)
Specified by:
isSpecified in interface org.xml.sax.ext.Attributes2

isSpecified

public boolean isSpecified(java.lang.String uri,
                           java.lang.String localName)
Specified by:
isSpecified in interface org.xml.sax.ext.Attributes2

getColumnNumber

public int getColumnNumber()
Specified by:
getColumnNumber in interface org.xml.sax.Locator

getLineNumber

public int getLineNumber()
Specified by:
getLineNumber in interface org.xml.sax.Locator

getPublicId

public java.lang.String getPublicId()
Specified by:
getPublicId in interface org.xml.sax.Locator

getSystemId

public java.lang.String getSystemId()
Specified by:
getSystemId in interface org.xml.sax.Locator

getEncoding

public java.lang.String getEncoding()
Specified by:
getEncoding in interface org.xml.sax.ext.Locator2

getXMLVersion

public java.lang.String getXMLVersion()
Specified by:
getXMLVersion in interface org.xml.sax.ext.Locator2

dtdReportComments

public boolean dtdReportComments()
Specified by:
dtdReportComments in interface DTDEventListener
Returns:
True, if there is a listener interested in getting comment events within DTD subset (since that's optional)

dtdComment

public void dtdComment(char[] data,
                       int offset,
                       int len)
Specified by:
dtdComment in interface DTDEventListener

dtdProcessingInstruction

public void dtdProcessingInstruction(java.lang.String target,
                                     java.lang.String data)
Specified by:
dtdProcessingInstruction in interface DTDEventListener

dtdSkippedEntity

public void dtdSkippedEntity(java.lang.String name)
Specified by:
dtdSkippedEntity in interface DTDEventListener

dtdNotationDecl

public void dtdNotationDecl(java.lang.String name,
                            java.lang.String publicId,
                            java.lang.String systemId,
                            java.net.URL baseURL)
                     throws javax.xml.stream.XMLStreamException
Specified by:
dtdNotationDecl in interface DTDEventListener
Throws:
javax.xml.stream.XMLStreamException

dtdUnparsedEntityDecl

public void dtdUnparsedEntityDecl(java.lang.String name,
                                  java.lang.String publicId,
                                  java.lang.String systemId,
                                  java.lang.String notationName,
                                  java.net.URL baseURL)
                           throws javax.xml.stream.XMLStreamException
Specified by:
dtdUnparsedEntityDecl in interface DTDEventListener
Throws:
javax.xml.stream.XMLStreamException

attributeDecl

public void attributeDecl(java.lang.String eName,
                          java.lang.String aName,
                          java.lang.String type,
                          java.lang.String mode,
                          java.lang.String value)
Specified by:
attributeDecl in interface DTDEventListener

dtdElementDecl

public void dtdElementDecl(java.lang.String name,
                           java.lang.String model)
Specified by:
dtdElementDecl in interface DTDEventListener

dtdExternalEntityDecl

public void dtdExternalEntityDecl(java.lang.String name,
                                  java.lang.String publicId,
                                  java.lang.String systemId)
Specified by:
dtdExternalEntityDecl in interface DTDEventListener

dtdInternalEntityDecl

public void dtdInternalEntityDecl(java.lang.String name,
                                  java.lang.String value)
Specified by:
dtdInternalEntityDecl in interface DTDEventListener