Javax.xml.Parsers.DocumentBuilder Class



Introduction

The javax.xml.Parsers.DocumentBuilder class defines the API to obtain DOM Document instances from an XML document.Following are the important points about Parsers.DocumentBuilder:

  • An application programmer can obtain a Document from XML using this class.

  • This class reuses several classes from the SAX API.

Class declaration

Following is the declaration for javax.xml.Parsers.DocumentBuilder class −

public abstract class DocumentBuilder
   extends Object

Class constructors

S.N. Constructor & Description
1 protected DocumentBuilder()

Protected Constructor.

Class methods

S.N. Method & Description
1 abstract DOMImplementation getDOMImplementation()

This method obtains an instance of a DOMImplementation object.

2 Schema getSchema()

This method gets a reference to the the Schema being used by the XML processor.

3 abstract boolean isNamespaceAware()

This method indicates whether or not this parser is configured to understand namespaces.

4 abstract boolean isValidating()

This method indicates whether or not this parser is configured to validate XML documents.

5 boolean isXIncludeAware()

This method gets the XInclude processing mode for this parser.

6 abstract Document newDocument()

This method obtains a new instance of a DOM Document object to build a DOM tree with.

7 Document parse(File f)

This method parse the content of the given file as an XML document and return a new DOM Document object

8 abstract Document parse(InputSource is)

This method parse the content of the given input source as an XML document and return a new DOM Document object.

9 Document parse(InputStream is)

This method parse the content of the given InputStream as an XML document and return a new DOM Document object.

10 Document parse(InputStream is, String systemId)

This method parse the content of the given InputStream as an XML document and return a new DOM Document object.

11 Document parse(String uri)

This method parse the content of the given URI as an XML document and return a new DOM Document object.

12 void reset()

This method reset this DocumentBuilder to its original configuration.

13 abstract void setEntityResolver(EntityResolver er)

This method specify the EntityResolver to be used to resolve entities present in the XML document to be parsed.

14 abstract void setErrorHandler(ErrorHandler eh)

This method specify the ErrorHandler to be used by the parser.

Methods inherited

This class inherits methods from the following classes −

java.lang.Object

Advertisements