org.merlotxml.util.xml.xml4j
Class DOMLiaison

java.lang.Object
  |
  +--org.merlotxml.util.xml.xml4j.DOMLiaison

public class DOMLiaison
extends java.lang.Object
implements ValidDOMLiaison


Inner Class Summary
 class DOMLiaison.DefaultErrorHandler
          Error handling class for the validating parser
 class DOMLiaison.MyEntityResolver
           
 
Field Summary
protected  java.util.List _entityResolverList
           
protected  java.util.Properties _properties
           
protected  com.lotus.xml.xml4j2dom.XML4JLiaison4dom liaison
           
 
Constructor Summary
DOMLiaison()
           
 
Method Summary
 void addEntityResolver(org.xml.sax.EntityResolver er)
          extra entity resolvers to use to find a dtd.
 org.w3c.dom.Document createDocument()
          Create a Document
 ValidDocument createValidDocument()
          Creates a new document that should maintain validity.
protected  void debug(java.lang.String s)
          simple debugging print routine
 ValidDocument parseValidXMLStream(java.io.InputStream is, java.lang.String fileLocation)
          Parses an input stream containing XML using a validating parser.
 org.w3c.dom.Document parseXMLStream(java.io.InputStream s)
          Parse a stream of XML into a Document
 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.
protected  void printNamedNodeMap(org.w3c.dom.NamedNodeMap nnm)
          used for debugging
 void setProperties(java.util.Properties p)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

liaison

protected com.lotus.xml.xml4j2dom.XML4JLiaison4dom liaison

_properties

protected java.util.Properties _properties

_entityResolverList

protected java.util.List _entityResolverList
Constructor Detail

DOMLiaison

public DOMLiaison()
Method Detail

createDocument

public org.w3c.dom.Document createDocument()
Description copied from interface: DOMLiaison
Create a Document
Tags copied from interface: DOMLiaison
Returns:
An empty Document

setProperties

public void setProperties(java.util.Properties p)

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

addEntityResolver

public void addEntityResolver(org.xml.sax.EntityResolver er)
extra entity resolvers to use to find a dtd. This allows the app to provide it's own. For example, if the app wants to present the user with a dialog to allow them to find the DTD.

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

print

public void print(org.w3c.dom.Document doc,
                  java.io.Writer output,
                  java.lang.String resultns,
                  boolean format)
           throws DOMLiaisonImplException
Description copied from interface: DOMLiaison
Print a Document
Tags copied from 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 s)
                                    throws DOMLiaisonImplException
Description copied from interface: DOMLiaison
Parse a stream of XML into a Document
Tags copied from interface: DOMLiaison
Parameters:
xmlReader - XML stream reader
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

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
Tags copied from 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.

printNamedNodeMap

protected void printNamedNodeMap(org.w3c.dom.NamedNodeMap nnm)
used for debugging

debug

protected void debug(java.lang.String s)
simple debugging print routine