javax.xml.parsers
Class DocumentBuilder

java.lang.Object
  |
  +--javax.xml.parsers.DocumentBuilder

public abstract class DocumentBuilder
extends java.lang.Object

Parser to create a DOM Document from an input source

 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
 DocumentBuilder parser = factory.newDocumentBuilder();
 Document doc = parser.parse(myInputSource);
 


Constructor Summary
DocumentBuilder()
           
 
Method Summary
abstract  DOMImplementation getDOMImplementation()
          Returns an instance of a DOM implementation
abstract  boolean isNamespaceAware()
          Returns true if the parser is namespace-aware
abstract  boolean isValidating()
          Returns true if the parser is validating
abstract  Document newDocument()
          Returns a new Document
 Document parse(java.io.File file)
          Parse given a File
abstract  Document parse(org.xml.sax.InputSource source)
          Parse given an input source
 Document parse(java.io.InputStream stream)
          Parse the given input stream
 Document parse(java.io.InputStream stream, java.lang.String systemId)
          Parse the given input stream
 Document parse(java.lang.String uri)
          Parse given a path name
abstract  void setEntityResolver(org.xml.sax.EntityResolver er)
          Sets the entity resolver
abstract  void setErrorHandler(org.xml.sax.ErrorHandler eh)
          Sets the error handler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentBuilder

public DocumentBuilder()
Method Detail

getDOMImplementation

public abstract DOMImplementation getDOMImplementation()
Returns an instance of a DOM implementation

isNamespaceAware

public abstract boolean isNamespaceAware()
Returns true if the parser is namespace-aware

isValidating

public abstract boolean isValidating()
Returns true if the parser is validating

newDocument

public abstract Document newDocument()
Returns a new Document

parse

public Document parse(java.io.File file)
               throws org.xml.sax.SAXException,
                      java.io.IOException
Parse given a File
Parameters:
file - a path to the file to open

parse

public abstract Document parse(org.xml.sax.InputSource source)
                        throws org.xml.sax.SAXException,
                               java.io.IOException
Parse given an input source
Parameters:
source - a SAX input source

parse

public Document parse(java.io.InputStream stream)
               throws org.xml.sax.SAXException,
                      java.io.IOException
Parse the given input stream
Parameters:
stream - the input stream to be used as a source

parse

public Document parse(java.io.InputStream stream,
                      java.lang.String systemId)
               throws org.xml.sax.SAXException,
                      java.io.IOException
Parse the given input stream
Parameters:
stream - the input stream to be used as a source
systemId - base for resolving relative URLs
Returns:
the parsed document
Since:
JAXP 1.1

parse

public Document parse(java.lang.String uri)
               throws org.xml.sax.SAXException,
                      java.io.IOException
Parse given a path name
Parameters:
uri - a path to the file to open
Returns:
the parsed document

setEntityResolver

public abstract void setEntityResolver(org.xml.sax.EntityResolver er)
Sets the entity resolver

setErrorHandler

public abstract void setErrorHandler(org.xml.sax.ErrorHandler eh)
Sets the error handler