Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
org.xml.sax.helpers

Class ParserAdapter

java.lang.Object
|
+--org.xml.sax.helpers.ParserAdapter

All Implemented Interfaces:

XMLReader, DocumentHandler


public class ParserAdapter

extends Object

implements XMLReader, DocumentHandler

Adapt a SAX1 Parser as a SAX2 XMLReader.
This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY. See http://www.saxproject.org for further information.

This class wraps a SAX1 org.xml.sax.Parser Parser and makes it act as a SAX2 org.xml.sax.XMLReader XMLReader, with feature, property, and Namespace support. Note that it is not possible to report org.xml.sax.ContentHandler#skippedEntity skippedEntity events, since SAX1 does not make that information available.

This adapter does not test for duplicate Namespace-qualified attribute names.

Since:Author:See Also:

Constructor Summary

ParserAdapter()

Construct a new parser adapter.
ParserAdapter(org.xml.sax.Parser parser)

Construct a new parser adapter.

Method Summary

voidcharacters(char[] ch, int start, int length)

Adapter implementation method; do not call.
voidendDocument()

Adapter implementation method; do not call.
voidendElement(java.lang.String qName)

Adapter implementation method; do not call.
org.xml.sax.ContentHandlergetContentHandler()

Return the current content handler.
org.xml.sax.DTDHandlergetDTDHandler()

Return the current DTD handler.
org.xml.sax.EntityResolvergetEntityResolver()

Return the current entity resolver.
org.xml.sax.ErrorHandlergetErrorHandler()

Return the current error handler.
booleangetFeature(java.lang.String name)

Check a parser feature flag.
java.lang.ObjectgetProperty(java.lang.String name)

Get a parser property.
voidignorableWhitespace(char[] ch, int start, int length)

Adapter implementation method; do not call.
voidparse(java.lang.String systemId)

Parse an XML document.
voidparse(org.xml.sax.InputSource input)

Parse an XML document.
voidprocessingInstruction(java.lang.String target, java.lang.String data)

Adapter implementation method; do not call.
voidsetContentHandler(org.xml.sax.ContentHandler handler)

Set the content handler.
voidsetDTDHandler(org.xml.sax.DTDHandler handler)

Set the DTD handler.
voidsetDocumentLocator(org.xml.sax.Locator locator)

Adapter implementation method; do not call.
voidsetEntityResolver(org.xml.sax.EntityResolver resolver)

Set the entity resolver.
voidsetErrorHandler(org.xml.sax.ErrorHandler handler)

Set the error handler.
voidsetFeature(java.lang.String name, boolean value)

Set a feature flag for the parser.
voidsetProperty(java.lang.String name, java.lang.Object value)

Set a parser property.
voidstartDocument()

Adapter implementation method; do not call.
voidstartElement(java.lang.String qName, org.xml.sax.AttributeList qAtts)

Adapter implementation method; do not call.

Constructor Details

ParserAdapter

public ParserAdapter()

Construct a new parser adapter.

Use the "org.xml.sax.parser" property to locate the embedded SAX1 driver.

Throws:


ParserAdapter

public ParserAdapter(org.xml.sax.Parser parser)

Construct a new parser adapter.

Note that the embedded parser cannot be changed once the adapter is created; to embed a different parser, allocate a new ParserAdapter.

Parameters:

Throws:


Method Details

characters

public void characters(char[] ch, int start, int length)

Adapter implementation method; do not call. Adapt a SAX1 characters event.

Parameters:

Throws:

See Also:


endDocument

public void endDocument()

Adapter implementation method; do not call. Adapt a SAX1 end document event.

Throws:

See Also:


endElement

public void endElement(java.lang.String qName)

Adapter implementation method; do not call. Adapt a SAX1 end element event.

Parameters:

Throws:

See Also:


getContentHandler

public ContentHandler getContentHandler()

Return the current content handler.

Returns:

See Also:


getDTDHandler

public DTDHandler getDTDHandler()

Return the current DTD handler.

Returns:

See Also:


getEntityResolver

public EntityResolver getEntityResolver()

Return the current entity resolver.

Returns:

See Also:


getErrorHandler

public ErrorHandler getErrorHandler()

Return the current error handler.

Returns:

See Also:


getFeature

public boolean getFeature(java.lang.String name)

Check a parser feature flag.

The only features recognized are namespaces and namespace-prefixes.

Parameters:

Returns:

Throws:

See Also:


getProperty

public Object getProperty(java.lang.String name)

Get a parser property.

No properties are currently recognized.

Parameters:

Returns:

Throws:

See Also:


ignorableWhitespace

public void ignorableWhitespace(char[] ch, int start, int length)

Adapter implementation method; do not call. Adapt a SAX1 ignorable whitespace event.

Parameters:

Throws:

See Also:


parse

public void parse(java.lang.String systemId)

Parse an XML document.

Parameters:

Throws:

See Also:


parse

public void parse(org.xml.sax.InputSource input)

Parse an XML document.

Parameters:

Throws:

See Also:


processingInstruction

public void processingInstruction(java.lang.String target, java.lang.String data)

Adapter implementation method; do not call. Adapt a SAX1 processing instruction event.

Parameters:

Throws:

See Also:


setContentHandler

public void setContentHandler(org.xml.sax.ContentHandler handler)

Set the content handler.

Parameters:

See Also:


setDTDHandler

public void setDTDHandler(org.xml.sax.DTDHandler handler)

Set the DTD handler.

Parameters:

See Also:


setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)

Adapter implementation method; do not call. Adapt a SAX1 document locator event.

Parameters:

See Also:


setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver resolver)

Set the entity resolver.

Parameters:

See Also:


setErrorHandler

public void setErrorHandler(org.xml.sax.ErrorHandler handler)

Set the error handler.

Parameters:

See Also:


setFeature

public void setFeature(java.lang.String name, boolean value)

Set a feature flag for the parser.

The only features recognized are namespaces and namespace-prefixes.

Parameters:

Throws:

See Also:


setProperty

public void setProperty(java.lang.String name, java.lang.Object value)

Set a parser property.

No properties are currently recognized.

Parameters:

Throws:

See Also:


startDocument

public void startDocument()

Adapter implementation method; do not call. Adapt a SAX1 start document event.

Throws:

See Also:


startElement

public void startElement(java.lang.String qName, org.xml.sax.AttributeList qAtts)

Adapter implementation method; do not call. Adapt a SAX1 startElement event.

If necessary, perform Namespace processing.

Parameters:

Throws: