Nux 1.6

nux.xom.pool
Class DocumentFactory

java.lang.Object
  extended by nux.xom.pool.DocumentFactory

public class DocumentFactory
extends Object

Creates and returns new Document objects using flexible parametrization (thread-safe). This implementation is thread-safe.

Author:
whoschek.AT.lbl.DOT.gov, $Author: hoschek3 $
See Also:
Builder

Constructor Summary
DocumentFactory()
          Creates a factory instance.
 
Method Summary
 Document createDocument(File input)
          Creates and returns a new document for the given input file.
 Document createDocument(InputStream input, URI baseURI)
          Creates and returns a new document for the given input stream and base URI.
 DocumentFactory getBinaryXMLFactory()
          Returns a factory that reads binary XML files using BinaryXMLCodec.
protected  Builder newBuilder()
          Overridable callback that returns a Builder for XML parsing; This default implementation returns a non-validating Builder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentFactory

public DocumentFactory()
Creates a factory instance.

Method Detail

createDocument

public Document createDocument(File input)
                        throws ParsingException,
                               IOException
Creates and returns a new document for the given input file.

Parameters:
input - the file to read from
Returns:
a new document
Throws:
IOException - if an I/O error occurs while reading from the stream
ParsingException - if an XML parsing error occurs

createDocument

public Document createDocument(InputStream input,
                               URI baseURI)
                        throws ParsingException,
                               IOException
Creates and returns a new document for the given input stream and base URI.

At least one of the parameters input and baseURI must not be null.

Parameters:
input - the stream to read from (may be null)
baseURI - the base URI of the document (may be null)
Returns:
a new document
Throws:
IOException - if an I/O error occurs while reading from the stream
ParsingException - if an XML parsing error occurs

newBuilder

protected Builder newBuilder()
Overridable callback that returns a Builder for XML parsing; This default implementation returns a non-validating Builder.

Returns:
a builder

getBinaryXMLFactory

public DocumentFactory getBinaryXMLFactory()
Returns a factory that reads binary XML files using BinaryXMLCodec.

Returns:
a binary XML factory

Nux 1.6