Top Description Inners Fields Constructors Methods
com.ctc.wstx.sax

public Class WstxSAXParser

extends SAXParser
implements Parser, XMLReader, Attributes2, Locator2, DTDEventListener
Class Inheritance
All Implemented Interfaces
com.ctc.wstx.dtd.DTDEventListener, org.xml.sax.ext.Locator2, org.xml.sax.Locator, org.xml.sax.ext.Attributes2, org.xml.sax.Attributes, org.xml.sax.XMLReader, org.xml.sax.Parser
Annotations
@SuppressWarnings:deprecation
Imports
java.io.*, java.net.URL, javax.xml.XMLConstants, javax.xml.parsers.SAXParser, javax.xml.stream.Location, .XMLResolver, .XMLStreamConstants, .XMLStreamException, org.xml.sax.*, org.xml.sax.helpers.DefaultHandler, org.xml.sax.ext.Attributes2, .DeclHandler, .LexicalHandler, .Locator2, com.ctc.wstx.api.ReaderConfig, com.ctc.wstx.dtd.DTDEventListener, com.ctc.wstx.exc.WstxIOException, com.ctc.wstx.io.DefaultInputResolver, .InputBootstrapper, .ReaderBootstrapper, .StreamBootstrapper, .SystemId, com.ctc.wstx.sr.*, com.ctc.wstx.stax.WstxInputFactory, com.ctc.wstx.util.ExceptionUtil, .URLUtil

References Deprecated

Parser is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
WstxSAXParser.AttributesWrapper

References Deprecated AttributeList is deprecated or references (maybe indirectly) at least one deprecated element.
pack-priv static class
pack-priv class
WstxSAXParser.ResolverProxy

Simple helper class that converts from Stax API into SAX EntityResolver call(s)

Field Summary

Modifier and TypeField and Description
pack-priv static final boolean
protected AttributeCollector
protected int
mAttrCount

Number of attributes accessible via Attributes and Attributes2 interfaces, for the current start element.

protected final ReaderConfig
protected ContentHandler
protected DeclHandler
protected DTDHandler
protected InputElementStack
protected String
protected EntityResolver
protected ErrorHandler
protected boolean
protected LexicalHandler
protected int
mNsCount

Need to keep track of number of namespaces, if namespace declarations are to be reported along with attributes (see mFeatNsPrefixes).

protected BasicStreamReader
mScanner

Since the stream reader would mostly be just a wrapper around the underlying scanner (its main job is to implement Stax interface), we can and should just use the scanner.

protected boolean
protected final WstxInputFactory
mStaxFactory

We will need the factory reference mostly for constructing underlying stream reader we use.

protected String

Constructor Summary

AccessConstructor and Description
public
WstxSAXParser(WstxInputFactory sf, boolean nsPrefixes)

Note

this was a protected constructor for versions 4.0 and 3.2; changed to public in 4.1

public

Method Summary

Modifier and TypeMethod and Description
public void
public void
dtdComment(char[] data, int offset, int len)

Implements com.ctc.wstx.dtd.DTDEventListener.dtdComment.

public void
public void
public void
public void
public void
public boolean
public void
public void
private final void
fireAuxEvent(int type, boolean inTree)

private final void
fireEvents()

This is the actual "tight event loop" that will send all events between start and end document events.

private final void
public int
getColumnNumber()

Implements org.xml.sax.Locator.getColumnNumber.

Return the column number where the current document event ends.

public ContentHandler
getContentHandler()

Implements org.xml.sax.XMLReader.getContentHandler.

Return the current content handler.

public DTDHandler
getDTDHandler()

Implements org.xml.sax.XMLReader.getDTDHandler.

Return the current DTD handler.

public String
getEncoding()

Implements org.xml.sax.ext.Locator2.getEncoding.

Returns the name of the character encoding for the entity.

public EntityResolver
getEntityResolver()

Implements org.xml.sax.XMLReader.getEntityResolver.

Return the current entity resolver.

public ErrorHandler
getErrorHandler()

Implements org.xml.sax.XMLReader.getErrorHandler.

Return the current error handler.

public boolean
getFeature(String
The feature name, which is a fully-qualified URI.
name
)

Implements org.xml.sax.XMLReader.getFeature.

Look up the value of a feature flag.

public int
getIndex(String
The qualified (prefixed) name.
qName
)

Implements org.xml.sax.Attributes.getIndex.

Look up the index of an attribute by XML qualified (prefixed) name.

public int
getIndex(String
The Namespace URI, or the empty string if the name has no Namespace URI.
uri
,
String
The attribute's local name.
localName
)

Implements org.xml.sax.Attributes.getIndex.

Look up the index of an attribute by Namespace name.

public int
getLength()

Implements org.xml.sax.Attributes.getLength.

Return the number of attributes in the list.

public int
getLineNumber()

Implements org.xml.sax.Locator.getLineNumber.

Return the line number where the current document event ends.

public String
getLocalName(int
The attribute index (zero-based).
index
)

Implements org.xml.sax.Attributes.getLocalName.

Look up an attribute's local name by index.

public final Parser
getParser()

Implements abstract javax.xml.parsers.SAXParser.getParser.

References Deprecated Parser is deprecated or references (maybe indirectly) at least one deprecated element.

Returns the SAX parser that is encapsulated by the implementation of this class.

public Object
getProperty(String
The property name, which is a fully-qualified URI.
name
)

Implements abstract javax.xml.parsers.SAXParser.getProperty.

Implements org.xml.sax.XMLReader.getProperty.

Look up the value of a property.

public String
getPublicId()

Implements org.xml.sax.Locator.getPublicId.

Return the public identifier for the current document event.

public String
getQName(int
The attribute index (zero-based).
index
)

Implements org.xml.sax.Attributes.getQName.

Look up an attribute's XML qualified (prefixed) name by index.

public final ReaderConfig
getStaxConfig()

Accessor used to allow configuring all standard Stax configuration settings that the underlying reader uses.

public String
getSystemId()

Implements org.xml.sax.Locator.getSystemId.

Return the system identifier for the current document event.

public String
getType(int
The attribute index (zero-based).
index
)

Implements org.xml.sax.Attributes.getType.

Look up an attribute's type by index.

public String
getType(String
The XML qualified name.
qName
)

Implements org.xml.sax.Attributes.getType.

Look up an attribute's type by XML qualified (prefixed) name.

public String
getType(String
The Namespace URI, or the empty String if the name has no Namespace URI.
uri
,
String
The local name of the attribute.
localName
)

Implements org.xml.sax.Attributes.getType.

Look up an attribute's type by Namespace name.

public String
getURI(int
The attribute index (zero-based).
index
)

Implements org.xml.sax.Attributes.getURI.

Look up an attribute's Namespace URI by index.

public String
getValue(int
The attribute index (zero-based).
index
)

Implements org.xml.sax.Attributes.getValue.

Look up an attribute's value by index.

public String
getValue(String
The XML qualified name.
qName
)

Implements org.xml.sax.Attributes.getValue.

Look up an attribute's value by XML qualified (prefixed) name.

public String
getValue(String
The Namespace URI, or the empty String if the name has no Namespace URI.
uri
,
String
The local name of the attribute.
localName
)

Implements org.xml.sax.Attributes.getValue.

Look up an attribute's value by Namespace name.

public final XMLReader
getXMLReader()

Implements abstract javax.xml.parsers.SAXParser.getXMLReader.

Returns the org.xml.sax.XMLReader that is encapsulated by the implementation of this class.

public String
getXMLVersion()

Implements org.xml.sax.ext.Locator2.getXMLVersion.

Returns the version of XML used for the entity.

public boolean
isDeclared(int
The attribute index (zero-based).
index
)

Implements org.xml.sax.ext.Attributes2.isDeclared.

Returns false unless the attribute was declared in the DTD.

public boolean
isDeclared(String
The XML qualified (prefixed) name.
qName
)

Implements org.xml.sax.ext.Attributes2.isDeclared.

Returns false unless the attribute was declared in the DTD.

public boolean
isDeclared(String
The Namespace URI, or the empty string if the name has no Namespace URI.
uri
,
String
The attribute's local name.
localName
)

Implements org.xml.sax.ext.Attributes2.isDeclared.

Returns false unless the attribute was declared in the DTD.

public boolean
isNamespaceAware()

Implements abstract javax.xml.parsers.SAXParser.isNamespaceAware.

Indicates whether or not this parser is configured to understand namespaces.

public boolean
isSpecified(int
The attribute index (zero-based).
index
)

Implements org.xml.sax.ext.Attributes2.isSpecified.

Returns true unless the attribute value was provided by DTD defaulting.

public boolean
isSpecified(String
The XML qualified (prefixed) name.
qName
)

Implements org.xml.sax.ext.Attributes2.isSpecified.

Returns true unless the attribute value was provided by DTD defaulting.

public boolean
isSpecified(String
The Namespace URI, or the empty string if the name has no Namespace URI.
uri
,
String
The attribute's local name.
localName
)

Implements org.xml.sax.ext.Attributes2.isSpecified.

Returns true unless the attribute value was provided by DTD defaulting.

public boolean
isValidating()

Implements abstract javax.xml.parsers.SAXParser.isValidating.

Indicates whether or not this parser is configured to validate XML documents.

public void
parse(InputSource
The InputSource containing the content to be parsed.
is
,
HandlerBase
The SAX HandlerBase to use.
hb
)

Overrides javax.xml.parsers.SAXParser.parse.

References Deprecated HandlerBase is deprecated or references (maybe indirectly) at least one deprecated element.

Parse the content given org.xml.sax.InputSource as XML using the specified org.xml.sax.HandlerBase.

public void
parse(InputSource
The InputSource containing the content to be parsed.
is
,
DefaultHandler
The SAX DefaultHandler to use.
dh
)

Overrides javax.xml.parsers.SAXParser.parse.

Parse the content given org.xml.sax.InputSource as XML using the specified org.xml.sax.helpers.DefaultHandler.

public void
parse(InputSource
The input source for the top-level of the XML document.
input
)

Implements org.xml.sax.Parser.parse, org.xml.sax.XMLReader.parse.

Parse an XML document.

public void
parse(String
The system identifier (URI).
systemId
)

Implements org.xml.sax.Parser.parse, org.xml.sax.XMLReader.parse.

Parse an XML document from a system identifier (URI).

public void
setContentHandler(ContentHandler
The content handler.
handler
)

Implements org.xml.sax.XMLReader.setContentHandler.

Allow an application to register a content event handler.

public void
setDocumentHandler(DocumentHandler
The document handler.
handler
)

Implements org.xml.sax.Parser.setDocumentHandler.

References Deprecated DocumentHandler is deprecated or references (maybe indirectly) at least one deprecated element.

Allow an application to register a document event handler.

public void
setDTDHandler(DTDHandler
The DTD handler.
handler
)

Implements org.xml.sax.Parser.setDTDHandler, org.xml.sax.XMLReader.setDTDHandler.

Allow an application to register a DTD event handler.

public void
setEntityResolver(EntityResolver
The object for resolving entities.
resolver
)

Implements org.xml.sax.Parser.setEntityResolver, org.xml.sax.XMLReader.setEntityResolver.

Allow an application to register a custom entity resolver.

public void
setErrorHandler(ErrorHandler
The error handler.
handler
)

Implements org.xml.sax.Parser.setErrorHandler, org.xml.sax.XMLReader.setErrorHandler.

Allow an application to register an error event handler.

public void
setFeature(String
The feature name, which is a fully-qualified URI.
name
,
boolean
The requested value of the feature (true or false).
value
)

Implements org.xml.sax.XMLReader.setFeature.

Set the value of a feature flag.

public void
setLocale(Locale
A Java Locale object.
locale
)

Implements org.xml.sax.Parser.setLocale.

Allow an application to request a locale for errors and warnings.

public void
setProperty(String
The property name, which is a fully-qualified URI.
name
,
Object
The requested value for the property.
value
)

Implements abstract javax.xml.parsers.SAXParser.setProperty.

Implements org.xml.sax.XMLReader.setProperty.

Set the value of a property.

private void
private void
private void
Inherited from javax.xml.parsers.SAXParser:
getSchemaisXIncludeAwareparseparseparseparseparseparseparseparsereset