org.merlotxml.util.xml.xerces
Class DOMLiaison

java.lang.Object
  extended byorg.merlotxml.util.xml.xerces.DOMLiaison
All Implemented Interfaces:
DOMLiaison, ValidDOMLiaison

public class DOMLiaison
extends java.lang.Object
implements ValidDOMLiaison

Xerces DOM Liaison Implementation

Author:
Tim McCune

Nested Class Summary
 class DOMLiaison.DefaultErrorHandler
          Error handling class for the validating parser
 class DOMLiaison.MyEntityResolver
           
 
Field Summary
protected  java.util.Vector _entityResolverList
           
 
Constructor Summary
DOMLiaison()
           
 
Method Summary
 void addEntityResolver(org.xml.sax.EntityResolver er)
           
 org.w3c.dom.Document createDocument()
          Create a Document
 ValidDocument createValidDocument()
          Creates a new document that should maintain validity.
 ValidDocument parseValidXMLStream(java.io.InputStream is, java.lang.String fileLocation)
          Parses an input stream containing XML using a validating parser.
 void parseValidXMLStream(ValidDocument doc, org.xml.sax.InputSource inputSource, org.xml.sax.ErrorHandler errorHandler, org.xml.sax.EntityResolver entityResolver)
           
 org.w3c.dom.Document parseXMLStream(java.io.InputStream is)
          Deprecated. Use parseXMLStream(Reader)
 org.w3c.dom.Document parseXMLStream(java.io.Reader in)
           
 void print(org.w3c.dom.Document doc, java.io.Writer output, java.lang.String resultns, boolean format)
          Print a Document
 void print(ValidDocument doc, java.io.Writer output, java.lang.String resultns, boolean format)
          Print that takes a valid document so it can print out the DTD specification properly.
 void setProperties(java.util.Properties props)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_entityResolverList

protected java.util.Vector _entityResolverList
Constructor Detail

DOMLiaison

public DOMLiaison()
Method Detail

createDocument

public org.w3c.dom.Document createDocument()
Create a Document

Specified by:
createDocument in interface DOMLiaison
Returns:
An empty Document

print

public void print(ValidDocument doc,
                  java.io.Writer output,
                  java.lang.String resultns,
                  boolean format)
           throws DOMLiaisonImplException
Description copied from interface: ValidDOMLiaison
Print that takes a valid document so it can print out the DTD specification properly.

Specified by:
print in interface ValidDOMLiaison
Throws:
DOMLiaisonImplException

print

public void print(org.w3c.dom.Document doc,
                  java.io.Writer output,
                  java.lang.String resultns,
                  boolean format)
           throws DOMLiaisonImplException
Print a Document

Specified by:
print in interface DOMLiaison
Parameters:
doc - The Document to print
output - Writer to send the output to
resultns - Result name space for the output. Used for things like HTML hacks.
format - If true, output will be nicely tab-formatted. If false, there shouldn't be any line breaks or tabs between elements in the output. Sometimes setting this to false is necessary to get your HTML to work right.
Throws:
DOMLiaisonImplException - Wrapper exception that is thrown if the implementing class throws any kind of exception.

parseXMLStream

public org.w3c.dom.Document parseXMLStream(java.io.InputStream is)
                                    throws DOMLiaisonImplException
Deprecated. Use parseXMLStream(Reader)

Parse a stream of XML into a Document

Specified by:
parseXMLStream in interface DOMLiaison
Returns:
The Document that was parsed
Throws:
DOMLiaisonImplException - Wrapper exception that is thrown if the implementing class throws any kind of exception.

parseXMLStream

public org.w3c.dom.Document parseXMLStream(java.io.Reader in)
                                    throws DOMLiaisonImplException
Specified by:
parseXMLStream in interface DOMLiaison
Throws:
DOMLiaisonImplException

setProperties

public void setProperties(java.util.Properties props)
Specified by:
setProperties in interface DOMLiaison

addEntityResolver

public void addEntityResolver(org.xml.sax.EntityResolver er)
Specified by:
addEntityResolver in interface DOMLiaison

createValidDocument

public ValidDocument createValidDocument()
Description copied from interface: ValidDOMLiaison
Creates a new document that should maintain validity. NEW... not really used or implemented yet

Specified by:
createValidDocument in interface ValidDOMLiaison

parseValidXMLStream

public ValidDocument parseValidXMLStream(java.io.InputStream is,
                                         java.lang.String fileLocation)
                                  throws DOMLiaisonImplException
Parses an input stream containing XML using a validating parser. Returns a ValidDocument which gives access to DTD information and stuff.

Specified by:
parseValidXMLStream in interface ValidDOMLiaison
Parameters:
is - InputStream to parse
fileLocation - optional URL for the file used to find relative DTD's
Returns:
com.channelpoint.commerce.util.xml.ValidatedDocument
Throws:
DOMLiaisonImplException - wrapper for exceptions thrown by the validating parser.

parseValidXMLStream

public void parseValidXMLStream(ValidDocument doc,
                                org.xml.sax.InputSource inputSource,
                                org.xml.sax.ErrorHandler errorHandler,
                                org.xml.sax.EntityResolver entityResolver)
                         throws DOMLiaisonImplException
Throws:
DOMLiaisonImplException