com.adactus.mpeg21.xml.schema
Class DocumentSource

java.lang.Object
  extended by com.adactus.mpeg21.xml.schema.ErrorHandlerImpl
      extended by com.adactus.mpeg21.xml.schema.DocumentSource
All Implemented Interfaces:
javolution.lang.Reusable, org.xml.sax.ErrorHandler
Direct Known Subclasses:
ValidatingDocumentSource

public class DocumentSource
extends ErrorHandlerImpl

Create a w3c XML Document object. Pattern:

1. DocumentBuilderFactory
2. DocumentBuilder
3. Document

Any errors and warnings are printed during the parsing by using the ErrorHandling interface. This class it not thread safe.


Constructor Summary
DocumentSource()
           
DocumentSource(boolean namespaceAware)
          Create a non-validating document source.
 
Method Summary
 org.w3c.dom.Document getDocument(java.io.InputStream in)
          Create document from an InputStream.
 org.w3c.dom.Document getDocument(java.io.Reader reader)
          Create document from an InputStream.
 org.w3c.dom.Document getDocument(java.lang.String urlString)
          Create document from a String.
 org.w3c.dom.Document getDocument(java.net.URL url)
          Create document from an URL.
 org.xml.sax.EntityResolver getEntityResolver()
           
 void initBuilder()
          Initialize DocumentBuilder.
 void initFactory()
          Initialize DocumentBuilderFactory.
 org.w3c.dom.Document newDocument()
          Create a new, empty Document.
static DocumentSource newInstance()
           
static void recycle(DocumentSource ck)
           
 void setEntityResolver(org.xml.sax.EntityResolver entityResolver)
           
 
Methods inherited from class com.adactus.mpeg21.xml.schema.ErrorHandlerImpl
error, fatalError, getStatus, reset, warning, wasError, wasFatalError, wasWaring
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentSource

public DocumentSource()

DocumentSource

public DocumentSource(boolean namespaceAware)
Create a non-validating document source.

Parameters:
namespaceAware - namespace aware enabled or disabled
Method Detail

getDocument

public org.w3c.dom.Document getDocument(java.io.InputStream in)
                                 throws java.lang.Exception
Create document from an InputStream.

Parameters:
in - the input stream
Returns:
the document
Throws:
java.lang.Exception

getDocument

public org.w3c.dom.Document getDocument(java.io.Reader reader)
                                 throws java.lang.Exception
Create document from an InputStream.

Parameters:
reader - the reader
Returns:
the document
Throws:
java.lang.Exception

getDocument

public org.w3c.dom.Document getDocument(java.lang.String urlString)
                                 throws java.lang.Exception
Create document from a String.

Parameters:
urlString - the input url location
Returns:
the document
Throws:
java.lang.Exception

getDocument

public org.w3c.dom.Document getDocument(java.net.URL url)
                                 throws java.lang.Exception
Create document from an URL.

Parameters:
url - the location of the input
Returns:
the document
Throws:
java.lang.Exception

getEntityResolver

public org.xml.sax.EntityResolver getEntityResolver()

initBuilder

public void initBuilder()
                 throws java.lang.Exception
Initialize DocumentBuilder.

Throws:
java.lang.Exception

initFactory

public void initFactory()
                 throws java.lang.Exception
Initialize DocumentBuilderFactory.

Throws:
java.lang.Exception

newDocument

public org.w3c.dom.Document newDocument()
Create a new, empty Document.

Returns:
a new document

newInstance

public static DocumentSource newInstance()

recycle

public static void recycle(DocumentSource ck)

setEntityResolver

public void setEntityResolver(org.xml.sax.EntityResolver entityResolver)