|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gnu.xml.util.DomParser
This parser emits SAX2 parsing events as it traverses a DOM tree, using any conformant implementation of DOM. It exposes all SAX1 features, and the following SAX2 features and properties (as identified by standard URIs which are not fully provided here). Note that if a Level 1 DOM implementation is given, then this behaves as if namespaces were disabled, and namespace prefixes were enabled.
Name | Notes |
---|---|
(URL)/external-general-entities | false (does no parsing) |
(URL)/external-parameter-entities | false (does no parsing) |
(URL)/namespaces | Value is fixed at true |
(URL)/namespace-prefixes | Value is settable, defaulting to false
(xmlns attributes hidden, and names aren't prefixed)
|
(URL)/string-interning | Value is fixed at false (DOM provides no guarantees as to interning) |
(URL)/validation | false (does no parsing) |
(URL)/lexical-handler/parameter-entities | false (DOM doesn't do parameter entities) |
(URL)/dom-node | This property may be set before parsing to hold a DOM Document node; any arguments given to parse methods are ignored. When retrieved during a parse, this value contains the "current" DOM node. |
(URL)/declaration-handler | A declaration handler may be provided. Declaration of external general entities is exposed, but not parameter entities; none of the entity names reported here will begin with "%". |
(URL)/lexical-handler | A lexical handler may be provided. While the start and end of any external subset are reported, expansion of other parameter entities (e.g. inside attribute list declarations) is not exposed. Expansion of general entities within attributes is also not exposed (see below). |
The consequences of modifying a DOM document tree as it is being walked by this "parser" are unspecified; don't do it!
Constructor Summary | |
DomParser()
Constructs an unitialized SAX2 parser. |
|
DomParser(Node node)
Constructs an SAX2 parser initialized to traverse the specified DOM tree. |
Method Summary | |
ContentHandler |
getContentHandler()
SAX2: Returns the object used to report the logical content of an XML document. |
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). |
boolean |
getFeature(java.lang.String featureId)
SAX2: Tells whether this parser supports the specified feature. |
java.lang.Object |
getProperty(java.lang.String propertyId)
SAX2: Returns the specified property. |
void |
parse(InputSource input)
SAX1: Parses the previously provided DOM document (the input parameter is ignored). |
void |
parse(java.lang.String uri)
SAX1: Parses the previously provided DOM document (the input parameter is ignored). |
void |
setContentHandler(ContentHandler handler)
SAX2: Assigns the object used to report the logical content of an XML document. |
void |
setDTDHandler(DTDHandler handler)
SAX1: Provides an object which may be used to intercept declarations related to notations and unparsed entities. |
void |
setEntityResolver(EntityResolver resolver)
SAX1: Provides an object which may be used when resolving external entities during parsing (both general and parameter entities). |
void |
setErrorHandler(ErrorHandler handler)
SAX1: Provides an object which receives callbacks for XML errors of all levels (fatal, nonfatal, warning). |
void |
setFeature(java.lang.String featureId,
boolean state)
SAX2: Sets the state of features supported in this parser. |
void |
setLocale(java.util.Locale locale)
SAX1: Identifies the locale which the parser should use for the diagnostics it provides. |
void |
setProperty(java.lang.String propertyId,
java.lang.Object property)
SAX2: Assigns the specified property. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DomParser()
public DomParser(Node node)
Method Detail |
public EntityResolver getEntityResolver()
getEntityResolver
in interface XMLReader
org.xml.sax.XMLReader
XMLReader.setEntityResolver(org.xml.sax.EntityResolver)
public void setEntityResolver(EntityResolver resolver)
setEntityResolver
in interface XMLReader
org.xml.sax.XMLReader
resolver
- The entity resolver.java.lang.NullPointerException
- If the resolver
argument is null.XMLReader.getEntityResolver()
public void setLocale(java.util.Locale locale) throws SAXException
SAXException
- as defined in the specification for
org.xml.sax.Parser.setLocale()public ErrorHandler getErrorHandler()
getErrorHandler
in interface XMLReader
org.xml.sax.XMLReader
XMLReader.setErrorHandler(org.xml.sax.ErrorHandler)
public void setErrorHandler(ErrorHandler handler)
setErrorHandler
in interface XMLReader
org.xml.sax.XMLReader
handler
- The error handler.java.lang.NullPointerException
- If the handler
argument is null.XMLReader.getErrorHandler()
public ContentHandler getContentHandler()
getContentHandler
in interface XMLReader
org.xml.sax.XMLReader
XMLReader.setContentHandler(org.xml.sax.ContentHandler)
public void setContentHandler(ContentHandler handler)
setContentHandler
in interface XMLReader
org.xml.sax.XMLReader
handler
- The content handler.java.lang.NullPointerException
- If the handler
argument is null.XMLReader.getContentHandler()
public DTDHandler getDTDHandler()
getDTDHandler
in interface XMLReader
org.xml.sax.XMLReader
XMLReader.setDTDHandler(org.xml.sax.DTDHandler)
public void setDTDHandler(DTDHandler handler)
setDTDHandler
in interface XMLReader
org.xml.sax.XMLReader
handler
- The DTD handler.java.lang.NullPointerException
- If the handler
argument is null.XMLReader.getDTDHandler()
public void parse(java.lang.String uri) throws SAXException
parse
in interface XMLReader
uri
- ignored (pass an empty string)SAXException
- as defined in the specification for
org.xml.sax.Parser.parse()public void parse(InputSource input) throws SAXException
parse
in interface XMLReader
input
- ignoredSAXException
- as defined in the specification for
org.xml.sax.Parser.parse()public boolean getFeature(java.lang.String featureId) throws SAXNotRecognizedException, SAXNotSupportedException
getFeature
in interface XMLReader
org.xml.sax.XMLReader
name
- The feature name, which is a fully-qualified URI.SAXNotRecognizedException
- When the
XMLReader does not recognize the feature name.SAXNotSupportedException
- When the
XMLReader recognizes the feature name but
cannot determine its value at this time.XMLReader.setFeature(java.lang.String, boolean)
public java.lang.Object getProperty(java.lang.String propertyId) throws SAXNotRecognizedException, SAXNotSupportedException
getProperty
in interface XMLReader
org.xml.sax.XMLReader
name
- The property name, which is a fully-qualified URI.SAXNotRecognizedException
- When the
XMLReader does not recognize the property name.SAXNotSupportedException
- When the
XMLReader recognizes the property name but
cannot determine its value at this time.XMLReader.setProperty(java.lang.String, java.lang.Object)
public void setFeature(java.lang.String featureId, boolean state) throws SAXNotRecognizedException, SAXNotSupportedException
setFeature
in interface XMLReader
org.xml.sax.XMLReader
name
- The feature name, which is a fully-qualified URI.state
- The requested state of the feature (true or false).SAXNotRecognizedException
- When the
XMLReader does not recognize the feature name.SAXNotSupportedException
- When the
XMLReader recognizes the feature name but
cannot set the requested value.XMLReader.getFeature(java.lang.String)
public void setProperty(java.lang.String propertyId, java.lang.Object property) throws SAXNotRecognizedException, SAXNotSupportedException
setProperty
in interface XMLReader
org.xml.sax.XMLReader
name
- The property name, which is a fully-qualified URI.state
- The requested value for the property.SAXNotRecognizedException
- When the
XMLReader does not recognize the property name.SAXNotSupportedException
- When the
XMLReader recognizes the property name but
cannot set the requested value.
|
Source code is GPL'd in the JAXP subproject at http://savannah.gnu.org/projects/classpathx |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |