javax.xml.parsers
Class DocumentBuilder
java.lang.Object
javax.xml.parsers.DocumentBuilder
public abstract class DocumentBuilder
extends java.lang.Object
Convenience class for parsing an XML document into a W3C DOM object
graph.
Instances of this class are not guaranteed to be thread safe.
DocumentBuilder
protected DocumentBuilder()
getDOMImplementation
public DOMImplementation getDOMImplementation()
Returns the DOM implementation.
getSchema
public Schema getSchema()
Returns the schema in use by the XML processor.
isNamespaceAware
public boolean isNamespaceAware()
Indicates whether this document builder is XML Namespace aware.
isValidating
public boolean isValidating()
Indicates whether this document builder will validate its input.
isXIncludeAware
public boolean isXIncludeAware()
Returns the XInclude processing mode in use by the parser.
parse
public Document parse(File f)
throws SAXException,
IOException
Parse the specified file and return a DOM Document.
f
- the XML file
parse
public Document parse(InputStream is)
throws SAXException,
IOException
Parse the specified input stream and return a DOM Document.
Prefer the version of this method that specifies a system ID, in order
to resolve external references correctly.
is
- an XML input stream
parse
public Document parse(InputStream is,
String systemId)
throws SAXException,
IOException
Parse the specified input stream and return a DOM Document.
is
- an XML input streamsystemId
- the system ID of the XML document
parse
public Document parse(String uri)
throws SAXException,
IOException
Parse the content of the specified URI and return a DOM Document.
uri
- an XML system ID
reset
public void reset()
Reset this document builder to its original configuration.
- 1.3
setEntityResolver
public void setEntityResolver(EntityResolver er)
Sets the SAX entity resolver callback used to resolve external entities
in the XML document(s) to parse.
er
- an entity resolver
setErrorHandler
public void setErrorHandler(ErrorHandler eh)
Sets the SAX error handler callback used to report parsing errors.
eh
- the error handler