com.taursys.dom
Class DocumentAdapterBuilder

java.lang.Object
  extended bycom.taursys.dom.DocumentAdapterBuilder
Direct Known Subclasses:
JAXPDocumentAdapterBuilder, TestDocumentAdapterBuilder, TidyDocumentAdapterBuilder, XercesDocumentAdapterBuilder

public abstract class DocumentAdapterBuilder
extends java.lang.Object

DocumentAdapterBuilder is used to create DocumentAdapters. It provides a variety of build methods.

Version:
$Revision: 1.3 $
Author:
marty

Field Summary
protected static java.lang.String MESSAGE_NULL_INPUT_STREAM
           
 
Constructor Summary
DocumentAdapterBuilder()
           
 
Method Summary
 DocumentAdapter build(java.lang.ClassLoader loader, java.lang.String resourceName)
          Build a new DocumentAdapter from the XML document read as a resource using the given ClassLoader.
 DocumentAdapter build(java.lang.Class clazz, java.lang.String resourceName)
          Build a new DocumentAdapter from the XML document contained in the indicated resource in the jar of the given class.
abstract  DocumentAdapter build(java.io.InputStream is)
          Build a new DocumentAdapter from the XML document contained in the InputStream.
 DocumentAdapter build(java.lang.String uri)
          Build a new DocumentAdapter from the XML document found at the given String URI.
 DocumentAdapter build(java.net.URL url)
          Build a new DocumentAdapter from the XML document found at the URL.
abstract  boolean getFeature(java.lang.String featureName)
          Returns true if given featureName is enables, otherwise false See the Specific DocumentAdapterBuilder, DocumentBuilder and/or Parser for the specific Features and Properties.
abstract  java.lang.Object getProperty(java.lang.String propertyName)
          Gets the given property.
abstract  void setFeature(java.lang.String featureName, boolean value)
          Enables the given featureName if value is true, otherwise disables feature.
abstract  void setProperty(java.lang.String propertyName, java.lang.Object value)
          Sets the given property to the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MESSAGE_NULL_INPUT_STREAM

protected static final java.lang.String MESSAGE_NULL_INPUT_STREAM
See Also:
Constant Field Values
Constructor Detail

DocumentAdapterBuilder

public DocumentAdapterBuilder()
Method Detail

setProperty

public abstract void setProperty(java.lang.String propertyName,
                                 java.lang.Object value)
Sets the given property to the given value. See the Specific DocumentAdapterBuilder, DocumentBuilder and/or Parser for the specific Features and Properties.

Parameters:
propertyName - name of the property to set
value - for the property

getProperty

public abstract java.lang.Object getProperty(java.lang.String propertyName)
Gets the given property. See the Specific DocumentAdapterBuilder, DocumentBuilder and/or Parser for the specific Features and Properties.

Parameters:
propertyName - to retrieve
Returns:
value of property

setFeature

public abstract void setFeature(java.lang.String featureName,
                                boolean value)
Enables the given featureName if value is true, otherwise disables feature. See the Specific DocumentAdapterBuilder, DocumentBuilder and/or Parser for the specific Features and Properties.

Parameters:
featureName - to enable/disable
value - true to enable, false to disable

getFeature

public abstract boolean getFeature(java.lang.String featureName)
Returns true if given featureName is enables, otherwise false See the Specific DocumentAdapterBuilder, DocumentBuilder and/or Parser for the specific Features and Properties.

Parameters:
featureName - to query
Returns:
true if enabled, otherwise false

build

public abstract DocumentAdapter build(java.io.InputStream is)
                               throws DocumentAdapterBuilderException
Build a new DocumentAdapter from the XML document contained in the InputStream.

Parameters:
is - InputStream containing the XML source document
Returns:
a new DocumentAdapter
Throws:
DocumentAdapterBuilderException - if invalid parameters or problems parsing the document.

build

public DocumentAdapter build(java.lang.Class clazz,
                             java.lang.String resourceName)
                      throws DocumentAdapterBuilderException
Build a new DocumentAdapter from the XML document contained in the indicated resource in the jar of the given class.

Parameters:
clazz - use jar file (or class directory) which contains this class
resourceName - name of file containing the XML source document
Returns:
a new DocumentAdapter
Throws:
DocumentAdapterBuilderException - if invalid parameters or problems parsing the document.

build

public DocumentAdapter build(java.lang.ClassLoader loader,
                             java.lang.String resourceName)
                      throws DocumentAdapterBuilderException
Build a new DocumentAdapter from the XML document read as a resource using the given ClassLoader.

Parameters:
loader - ClassLoader to read the resource
resourceName - name of file containing the XML source document
Returns:
a new DocumentAdapter
Throws:
DocumentAdapterBuilderException - if invalid parameters or problems parsing the document.

build

public DocumentAdapter build(java.net.URL url)
                      throws DocumentAdapterBuilderException
Build a new DocumentAdapter from the XML document found at the URL.

Parameters:
url - URL pointing to the XML source document
Returns:
a new DocumentAdapter
Throws:
DocumentAdapterBuilderException - if invalid parameters or problems parsing the document.

build

public DocumentAdapter build(java.lang.String uri)
                      throws DocumentAdapterBuilderException
Build a new DocumentAdapter from the XML document found at the given String URI. If the protocol specified is resource:// then the Document will be read as a Resource from the class loader. If the authority (eg resource://[AUTHORITY]/path/doc.xml) is not specified, then the Document will be loaded from the ClassLoader of the current Thread, otherwise it will be loaded from the class specified in the authority section of the URL (eg resource://com.company.MyClass/path/doc.xml).

Parameters:
uri - URI pointing to the XML source document
Returns:
a new DocumentAdapter
Throws:
DocumentAdapterBuilderException - if invalid parameters or problems parsing or validating the document.


Copyright © 2007 Martin T Phelan. All Rights Reserved.