|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
org.xml.sax.helpers.XMLReaderAdapter
, Parser

public class XMLReaderAdapter

, ContentHandler

Adapt a SAX2 XMLReader as a SAX1 Parser.
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 SAX2 XMLReader
and makes it act as a SAX1 Parser
. The XMLReader
must support a true value for the
http://xml.org/sax/features/namespace-prefixes property or parsing will fail
with a SAXException
; if the XMLReader
supports a false value for the http://xml.org/sax/features/namespaces
property, that will also be used to improve efficiency.
Parser
,
XMLReader

| Constructor Summary | |
|---|---|
XMLReaderAdapter
Create a new adapter. |
|
XMLReaderAdapter
Create a new adapter. |
|
| Method Summary | |
|---|---|
void |
characters
Adapt a SAX2 characters event. |
void |
endDocument
End document event. |
void |
endElement
Adapt a SAX2 end element event. |
void |
endPrefixMapping
Adapt a SAX2 end prefix mapping event. |
void |
ignorableWhitespace
Adapt a SAX2 ignorable whitespace event. |
void |
parse
Parse the document. |
void |
parse
Parse the document. |
void |
processingInstruction
Adapt a SAX2 processing instruction event. |
void |
setDocumentHandler
Register the SAX1 document event handler. |
void |
setDocumentLocator
Set a document locator. |
void |
setDTDHandler
Register the DTD event handler. |
void |
setEntityResolver
Register the entity resolver. |
void |
setErrorHandler
Register the error event handler. |
void |
setLocale
Set the locale for error reporting. |
void |
skippedEntity
Adapt a SAX2 skipped entity event. |
void |
startDocument
Start document event. |
void |
startElement
Adapt a SAX2 start element event. |
void |
startPrefixMapping
Adapt a SAX2 start prefix mapping event. |
Methods inherited from class java.lang.Object ![]() |
|---|
clone |
| Constructor Detail |
|---|

public XMLReaderAdapter()
throws SAXException

Use the "org.xml.sax.driver" property to locate the SAX2 driver to embed.
SAXException

- If the embedded driver
cannot be instantiated or if the
org.xml.sax.driver property is not specified.

public XMLReaderAdapter(XMLReader![]()
![]()
xmlReader)
Create a new adapter, wrapped around a SAX2 XMLReader. The adapter will make the XMLReader act like a SAX1 Parser.
xmlReader - The SAX2 XMLReader to wrap.
NullPointerException

- If the argument is null.| Method Detail |
|---|

public void setLocale(Locale![]()
![]()
locale) throws SAXException
![]()
![]()
This is not supported in SAX2, and will always throw an exception.
setLocale

in interface Parser

locale - the locale for error reporting.
SAXException

- Thrown unless overridden.Parser.setLocale(java.util.Locale)


public void setEntityResolver(EntityResolver![]()
![]()
resolver)
setEntityResolver

in interface Parser

resolver - The new resolver.Parser.setEntityResolver(org.xml.sax.EntityResolver)


public void setDTDHandler(DTDHandler![]()
![]()
handler)
setDTDHandler

in interface Parser

handler - The new DTD event handler.Parser.setDTDHandler(org.xml.sax.DTDHandler)


public void setDocumentHandler(DocumentHandler![]()
![]()
handler)
Note that the SAX1 document handler has no Namespace support.
setDocumentHandler

in interface Parser

handler - The new SAX1 document event handler.Parser.setDocumentHandler(org.xml.sax.DocumentHandler)


public void setErrorHandler(ErrorHandler![]()
![]()
handler)
setErrorHandler

in interface Parser

handler - The new error event handler.Parser.setErrorHandler(org.xml.sax.ErrorHandler)


public void parse(String![]()
![]()
systemId) throws IOException
![]()
![]()
, SAXException
![]()
![]()
This method will throw an exception if the embedded XMLReader does not support the http://xml.org/sax/features/namespace-prefixes property.
parse

in interface Parser

systemId - The absolute URL of the document.
IOException

- If there is a problem reading
the raw content of the document.
SAXException

- If there is a problem
processing the document.parse(org.xml.sax.InputSource)
,
Parser.parse(java.lang.String)


public void parse(InputSource![]()
![]()
input) throws IOException
![]()
![]()
, SAXException
![]()
![]()
This method will throw an exception if the embedded XMLReader does not support the http://xml.org/sax/features/namespace-prefixes property.
parse

in interface Parser

input - An input source for the document.
IOException

- If there is a problem reading
the raw content of the document.
SAXException

- If there is a problem
processing the document.parse(java.lang.String)
,
Parser.parse(org.xml.sax.InputSource)


public void setDocumentLocator(Locator![]()
![]()
locator)
setDocumentLocator

in interface ContentHandler

locator - The document locator.ContentHandler.setDocumentLocator(org.xml.sax.Locator)


public void startDocument()
throws SAXException

startDocument

in interface ContentHandler

SAXException

- The client may raise a
processing exception.ContentHandler.startDocument()


public void endDocument()
throws SAXException

endDocument

in interface ContentHandler

SAXException

- The client may raise a
processing exception.ContentHandler.endDocument()


public void startPrefixMapping(String![]()
![]()
prefix, String
![]()
![]()
uri)
startPrefixMapping

in interface ContentHandler

prefix - The prefix being mapped.uri - The Namespace URI being mapped to.ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)


public void endPrefixMapping(String![]()
![]()
prefix)
endPrefixMapping

in interface ContentHandler

prefix - The prefix being mapped.ContentHandler.endPrefixMapping(java.lang.String)


public void startElement(String![]()
![]()
uri, String
![]()
![]()
localName, String
![]()
![]()
qName, Attributes
![]()
![]()
atts) throws SAXException
![]()
![]()
startElement

in interface ContentHandler

uri - The Namespace URI.localName - The Namespace local name.qName - The qualified (prefixed) name.atts - The SAX2 attributes.
SAXException

- The client may raise a
processing exception.ContentHandler.endDocument()


public void endElement(String![]()
![]()
uri, String
![]()
![]()
localName, String
![]()
![]()
qName) throws SAXException
![]()
![]()