xml
Class DocumentParser

java.lang.Object
  extended by xml.DocumentParser

public class DocumentParser
extends Object

A class allowing static access to a document builder. If applications need the (standard?) setup for validating, whitespace-removal and entity expanding, they can rely on this class.


Field Summary
private static DocumentBuilder build
          The document builder used by the target factory.
private static boolean EXPAND
          Default value for ignoring whitespace element content (true).
private static boolean VALIDATE
          Default value for validating (true).
private static boolean WHITESPACE
          Default value for ignoring whitespace element content (true).
 
Constructor Summary
DocumentParser()
           
 
Method Summary
static Document createEmptyDocument()
          Creates a new, empty target document.
static Document parse(InputSource input)
          The method to convert an XML-URL to the Document format.
static Document parseFile(File input)
          The method to convert an XML-URL to the Document format.
static Document parseInputStream(InputStream input)
          The method to convert an XML-URL to the Document format.
static Document parseReader(Reader input)
          The method to convert an XML-URL to the Document format.
static Document parseURL(URL input)
          The method to convert an XML-URL to the Document format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATE

private static final boolean VALIDATE
Default value for validating (true).

See Also:
Constant Field Values

WHITESPACE

private static final boolean WHITESPACE
Default value for ignoring whitespace element content (true).

See Also:
Constant Field Values

EXPAND

private static final boolean EXPAND
Default value for ignoring whitespace element content (true).

See Also:
Constant Field Values

build

private static DocumentBuilder build
The document builder used by the target factory.

Constructor Detail

DocumentParser

public DocumentParser()
Method Detail

createEmptyDocument

public static Document createEmptyDocument()
Creates a new, empty target document. This document should be used to include Document Fragments produced along the way. This method always creates a new document and is not backed by the Document created on class-load of the target factory, which is only used to create Document fragments.


parse

public static Document parse(InputSource input)
The method to convert an XML-URL to the Document format. This is the static version that returns the parsed document. If any exception occurs the returned document is null.


parseURL

public static Document parseURL(URL input)
The method to convert an XML-URL to the Document format. This is the static version that returns the parsed document. If any exception occurs the returned document is null.


parseInputStream

public static Document parseInputStream(InputStream input)
The method to convert an XML-URL to the Document format. This is the static version that returns the parsed document. If any exception occurs the returned document is null.


parseReader

public static Document parseReader(Reader input)
The method to convert an XML-URL to the Document format. This is the static version that returns the parsed document. If any exception occurs the returned document is null.


parseFile

public static Document parseFile(File input)
The method to convert an XML-URL to the Document format. This is the static version that returns the parsed document. If any exception occurs the returned document is null.
This method can not easily be diverted to an input source, so use the document builder method instead.