public class DOMDriver extends Object implements Locator, XMLReader
| Modifier and Type | Field and Description |
|---|---|
protected ContentHandler |
contentHandler |
protected Node |
root |
protected String |
systemId |
| Constructor and Description |
|---|
DOMDriver() |
| Modifier and Type | Method and Description |
|---|---|
int |
getColumnNumber() |
ContentHandler |
getContentHandler() |
DTDHandler |
getDTDHandler()
SAX2: Returns the object used to process declarations related
to notations and unparsed entities.
|
EntityResolver |
getEntityResolver()
SAX2: Returns the object used when resolving external
entities during parsing (both general and parameter entities).
|
ErrorHandler |
getErrorHandler()
SAX2: Returns the object used to receive callbacks for XML
errors of all levels (fatal, nonfatal, warning); this is never null;
|
boolean |
getFeature(String featureId)
SAX2: Tells the value of the specified feature flag.
|
int |
getLineNumber() |
Object |
getProperty(String name)
SAX2: Returns the specified property.
|
String |
getPublicId() |
String |
getSystemId() |
void |
parse()
Walk a document (traversing the nodes depth first)
|
void |
parse(InputSource source)
Parse from InputSource.
|
void |
parse(String source)
Parse from SystemId.
|
void |
setContentHandler(ContentHandler handler)
Set the content handler.
|
void |
setDocumentHandler(DocumentHandler handler)
Deprecated.
SAX2 programs should use the XMLReader interface
and a ContentHandler.
|
void |
setDTDHandler(DTDHandler handler)
SAX1, SAX2: Set the DTD handler for this parser.
|
void |
setEntityResolver(EntityResolver resolver)
SAX1, SAX2: Set the entity resolver for this parser.
|
void |
setErrorHandler(ErrorHandler handler)
SAX1, SAX2: Set the error handler for this parser.
|
void |
setFeature(String featureId,
boolean on)
SAX2: Sets the state of feature flags in this parser.
|
void |
setLocale(Locale locale)
SAX1: Sets the locale used for diagnostics; currently,
only locales using the English language are supported.
|
void |
setProperty(String propertyId,
Object property)
SAX2: Assigns the specified property.
|
void |
setStartNode(Node start)
Set the DOM Document that will be walked
|
void |
setSystemId(String systemId) |
protected ContentHandler contentHandler
protected Node root
protected String systemId
public void setContentHandler(ContentHandler handler)
setContentHandler in interface XMLReaderhandler - The object to receive content events. If this also implements LexicalHandler,
it will also be notified of comments.public ContentHandler getContentHandler()
getContentHandler in interface XMLReaderpublic void setLocale(Locale locale) throws SAXException
locale - The locale for which diagnostics will be generatedSAXExceptionpublic EntityResolver getEntityResolver()
getEntityResolver in interface XMLReaderpublic void setEntityResolver(EntityResolver resolver)
setEntityResolver in interface XMLReaderresolver - The object to receive entity events.public DTDHandler getDTDHandler()
getDTDHandler in interface XMLReaderpublic void setDTDHandler(DTDHandler handler)
setDTDHandler in interface XMLReaderhandler - The object to receive DTD events.public void setDocumentHandler(DocumentHandler handler)
handler - The object to receive document events.public void setErrorHandler(ErrorHandler handler)
setErrorHandler in interface XMLReaderhandler - The object to receive error events.public ErrorHandler getErrorHandler()
getErrorHandler in interface XMLReaderpublic void setStartNode(Node start)
public void parse(InputSource source) throws SAXException
parse in interface XMLReaderSAXExceptionpublic void parse(String source) throws SAXException
parse in interface XMLReaderSAXExceptionpublic void parse()
throws SAXException
SAXException - On any error in the documentpublic void setSystemId(String systemId)
public String getPublicId()
getPublicId in interface Locatorpublic String getSystemId()
getSystemId in interface Locatorpublic int getLineNumber()
getLineNumber in interface Locatorpublic int getColumnNumber()
getColumnNumber in interface Locatorpublic boolean getFeature(String featureId) throws SAXNotRecognizedException
getFeature in interface XMLReaderSAXNotRecognizedException - thrown if the feature flag
is neither built in, nor yet assigned.public Object getProperty(String name) throws SAXNotRecognizedException
getProperty in interface XMLReaderSAXNotRecognizedException - thrown if the property value
is neither built in, nor yet stored.public void setFeature(String featureId, boolean on) throws SAXNotRecognizedException, SAXNotSupportedException
setFeature in interface XMLReaderSAXNotRecognizedExceptionSAXNotSupportedExceptionpublic void setProperty(String propertyId, Object property) throws SAXNotRecognizedException, SAXNotSupportedException
setProperty in interface XMLReaderSAXNotRecognizedExceptionSAXNotSupportedException