GNU Classpath (0.95) | |
Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.xml.sax.helpers.ParserAdapter
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
Parser
and makes it act as a SAX2 XMLReader
,
with feature, property, and Namespace support. Note
that it is not possible to report skippedEntity
events, since SAX1 does not make that information available.
This adapter does not test for duplicate Namespace-qualified
attribute names.
XMLReaderAdapter
, XMLReader
, Parser
Constructor Summary | |
| |
|
Method Summary | |
void |
|
void |
|
void |
|
ContentHandler |
|
DTDHandler |
|
EntityResolver |
|
ErrorHandler |
|
boolean |
|
Object |
|
void |
|
void | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
public ParserAdapter() throws SAXException
Construct a new parser adapter. Use the "org.xml.sax.parser" property to locate the embedded SAX1 driver.
- Throws:
SAXException
- If the embedded driver cannot be instantiated or if the org.xml.sax.parser property is not specified.
public ParserAdapter(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:
parser
- The SAX1 parser to embed.
- Throws:
NullPointerException
- If the parser parameter is null.
public void characters(ch[] , int start, int length) throws SAXException
Adapter implementation method; do not call. Adapt a SAX1 characters event.
- Specified by:
- characters in interface DocumentHandler
- Parameters:
start
- The starting position in the array.length
- The number of characters to use.
- Throws:
SAXException
- The client may raise a processing exception.
public void endDocument() throws SAXException
Adapter implementation method; do not call. Adapt a SAX1 end document event.
- Specified by:
- endDocument in interface DocumentHandler
- Throws:
SAXException
- The client may raise a processing exception.
- See Also:
DocumentHandler.endDocument()
public void endElement(String qName) throws SAXException
Adapter implementation method; do not call. Adapt a SAX1 end element event.
- Specified by:
- endElement in interface DocumentHandler
- Parameters:
qName
- The qualified (prefixed) name.
- Throws:
SAXException
- The client may raise a processing exception.
- See Also:
DocumentHandler.endElement(String)
public ContentHandler getContentHandler()
Return the current content handler.
- Specified by:
- getContentHandler in interface XMLReader
- Returns:
- The current content handler, or null if none was supplied.
- See Also:
XMLReader.getEntityResolver()
public DTDHandler getDTDHandler()
Return the current DTD handler.
- Specified by:
- getDTDHandler in interface XMLReader
- Returns:
- the current DTD handler, or null if none was supplied
- See Also:
XMLReader.getEntityResolver()
public EntityResolver getEntityResolver()
Return the current entity resolver.
- Specified by:
- getEntityResolver in interface XMLReader
- Returns:
- The current entity resolver, or null if none was supplied.
- See Also:
XMLReader.getEntityResolver()
public ErrorHandler getErrorHandler()
Return the current error handler.
- Specified by:
- getErrorHandler in interface XMLReader
- Returns:
- The current error handler, or null if none was supplied.
- See Also:
XMLReader.getEntityResolver()
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException
Check a parser feature flag. The only features recognized are namespaces and namespace-prefixes.
- Specified by:
- getFeature in interface XMLReader
- Parameters:
name
- The feature name, as a complete URI.
- Returns:
- The current feature value.
- Throws:
SAXNotRecognizedException
- If the feature value can't be assigned or retrieved.SAXNotSupportedException
- If the feature is not currently readable.
- See Also:
XMLReader.setFeature(String,boolean)
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException
Get a parser property. No properties are currently recognized.
- Specified by:
- getProperty in interface XMLReader
- Parameters:
name
- The property name.
- Returns:
- The property value.
- Throws:
SAXNotRecognizedException
- If the property value can't be assigned or retrieved.SAXNotSupportedException
- If the property value is not currently readable.
- See Also:
XMLReader.getProperty(String)
public void ignorableWhitespace(ch[] , int start, int length) throws SAXException
Adapter implementation method; do not call. Adapt a SAX1 ignorable whitespace event.
- Specified by:
- ignorableWhitespace in interface DocumentHandler
- Parameters:
start
- The starting position in the array.length
- The number of characters to use.
- Throws:
SAXException
- The client may raise a processing exception.
public void parse(String systemId) throws IOException, SAXException
Parse an XML document.
- Parameters:
systemId
- The absolute URL of the document.
- Throws:
IOException
- If there is a problem reading the raw content of the document.SAXException
- If there is a problem processing the document.
- See Also:
parse(InputSource)
,Parser.parse(String)
public void parse(InputSource input) throws IOException, SAXException
Parse an XML document.
- Parameters:
input
- An input source for the document.
- Throws:
IOException
- If there is a problem reading the raw content of the document.SAXException
- If there is a problem processing the document.
- See Also:
parse(String)
,Parser.parse(InputSource)
public void processingInstruction(String target, String data) throws SAXException
Adapter implementation method; do not call. Adapt a SAX1 processing instruction event.
- Specified by:
- processingInstruction in interface DocumentHandler
- Parameters:
target
- The processing instruction target.data
- The remainder of the processing instruction
- Throws:
SAXException
- The client may raise a processing exception.
public void setContentHandler(ContentHandler handler)
Set the content handler.
- Specified by:
- setContentHandler in interface XMLReader
- Parameters:
handler
- the new content handler
public void setDTDHandler(DTDHandler handler)
Set the DTD handler.
- Specified by:
- setDTDHandler in interface XMLReader
- Parameters:
handler
- the new DTD handler
public void setDocumentLocator(Locator locator)
Adapter implementation method; do not call. Adapt a SAX1 document locator event.
- Specified by:
- setDocumentLocator in interface DocumentHandler
- Parameters:
locator
- A document locator.
public void setEntityResolver(EntityResolver resolver)
Set the entity resolver.
- Specified by:
- setEntityResolver in interface XMLReader
- Parameters:
resolver
- The new entity resolver.
public void setErrorHandler(ErrorHandler handler)
Set the error handler.
- Specified by:
- setErrorHandler in interface XMLReader
- Parameters:
handler
- The new error handler.
public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException
Set a feature flag for the parser. The only features recognized are namespaces and namespace-prefixes.
- Specified by:
- setFeature in interface XMLReader
- Parameters:
name
- The feature name, as a complete URI.value
- The requested feature value.
- Throws:
SAXNotRecognizedException
- If the feature can't be assigned or retrieved.SAXNotSupportedException
- If the feature can't be assigned that value.
- See Also:
XMLReader.setFeature(String,boolean)
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException
Set a parser property. No properties are currently recognized.
- Specified by:
- setProperty in interface XMLReader
- Parameters:
name
- The property name.value
- The property value.
- Throws:
SAXNotRecognizedException
- If the property value can't be assigned or retrieved.SAXNotSupportedException
- If the property can't be assigned that value.
- See Also:
XMLReader.setProperty(String,Object)
public void startDocument() throws SAXException
Adapter implementation method; do not call. Adapt a SAX1 start document event.
- Specified by:
- startDocument in interface DocumentHandler
- Throws:
SAXException
- The client may raise a processing exception.
- See Also:
DocumentHandler.startDocument()
public void startElement(String qName, AttributeList qAtts) throws SAXException
Adapter implementation method; do not call. Adapt a SAX1 startElement event. If necessary, perform Namespace processing.
- Specified by:
- startElement in interface DocumentHandler
- Parameters:
qName
- The qualified (prefixed) name.qAtts
- The XML attribute list (with qnames).
- Throws:
SAXException
- The client may raise a processing exception.
GNU Classpath (0.95) |