com.lotus.xsl.xml4j2tx
Class XML4JLiaison

java.lang.Object
  |
  +--com.lotus.xsl.XMLParserLiaisonDefault
        |
        +--com.lotus.xsl.xml4j2tx.XML4JLiaison

public class XML4JLiaison
extends XMLParserLiaisonDefault

A class that handles interfacing IBM's XML4J2 to the Lotus XSL Processor.


Field Summary
 boolean m_shouldExpandEntityRefs
          By default expand all entity references in the source and style trees.
 boolean m_xml4jprint
          Use XML4J's PrintVisitor class instead of LotusXSL's Formatter classes.
static java.lang.String XML4J_VERSION
           
 
Fields inherited from class com.lotus.xsl.XMLParserLiaisonDefault
m_attrSpecialChars, m_formatterListener, m_processor, m_use_validation, S_XMLNAMESPACEURI
 
Constructor Summary
XML4JLiaison()
          Construct an ProcessXSL instance, which implements the XMLProcessorLiaison interface.
XML4JLiaison(com.lotus.xsl.xml4j2tx.ErrorListener listener)
          Constructor that takes XML4J ErrorListener as an argument.
 
Method Summary
static void checkXML4JVersion()
          Check the XML4J version number
 com.lotus.xsl.xml4j2tx.Document createDocument()
          Create an empty DOM Document.
 com.lotus.xsl.xml4j2tx.Element getElementByID(java.lang.String id, com.lotus.xsl.xml4j2tx.Document doc)
          Given an ID, return the element.
 java.lang.String getExpandedAttributeName(com.lotus.xsl.xml4j2tx.Attr attr)
          Returns the attribute name with the namespace expanded.
 java.lang.String getExpandedElementName(com.lotus.xsl.xml4j2tx.Element elem)
          Returns the element name with the namespace expanded.
 java.lang.String getLocalNameOfNode(org.w3c.dom.Node n)
          Returns the local name of the given node.
 java.lang.String getNamespaceForPrefix(java.lang.String prefix, com.lotus.xsl.xml4j2tx.Element namespaceContext)
          Given a prefix and a namespace context, return the expanded namespace.
 org.w3c.dom.Node getParentOfNode(org.w3c.dom.Node node)
          Get the parent of a node.
 java.lang.String getParserDescription()
          Return a string suitible for telling the user what parser is being used.
 java.lang.String getTreeAsText(com.lotus.xsl.xml4j2tx.Document docTree)
          Get a document Tree as a text string suiteable for display in a browser.
 boolean isIgnorableWhitespace(com.lotus.xsl.xml4j2tx.Text node)
          Tell if the node is ignorable whitespace.
static void main(java.lang.String[] argv)
          Command line interfact to transform the XML according to the instructions found in the XSL document.
 com.lotus.xsl.xml4j2tx.Document parseXMLStream(java.io.Reader reader, java.lang.String filename)
          Parse the text pointed at by the reader as XML, and return a DOM Document interface.
 com.lotus.xsl.xml4j2tx.Document parseXMLStream(java.net.URL url)
          Parse the text pointed at by the URL, and return a DOM Document interface.
 void toMarkup(com.lotus.xsl.xml4j2tx.Document doc, java.io.PrintWriter pw, java.lang.String resultns, boolean format)
          Print the result tree.
 
Methods inherited from class com.lotus.xsl.XMLParserLiaisonDefault
getElementByID, getExpandedAttributeName, getExpandedElementName, getFormatterListener, getIndent, getLocalNameOfNode, getNamespaceForPrefix, getNamespaceOfNode, getParentOfNode, getShouldExpandEntityRefs, getSpecialCharacters, getUseValidation, isIgnorableWhitespace, parseXMLStream, setFormatterListener, setFormatterListener, setIndent, setProcessorOwner, SetShouldExpandEntityRefs, setSpecialCharacters, setUseValidation, toMarkup
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML4J_VERSION

public static final java.lang.String XML4J_VERSION

m_shouldExpandEntityRefs

public boolean m_shouldExpandEntityRefs
By default expand all entity references in the source and style trees.

m_xml4jprint

public boolean m_xml4jprint
Use XML4J's PrintVisitor class instead of LotusXSL's Formatter classes.
Constructor Detail

XML4JLiaison

public XML4JLiaison(com.lotus.xsl.xml4j2tx.ErrorListener listener)
Constructor that takes XML4J ErrorListener as an argument. The error listener is registered with the XML Parser. Any XML-related errors will be reported to the calling application using this error listener.
Parameters:
listener - XML4J ErrorListener instance.

XML4JLiaison

public XML4JLiaison()
Construct an ProcessXSL instance, which implements the XMLProcessorLiaison interface.
Method Detail

getParserDescription

public java.lang.String getParserDescription()
Return a string suitible for telling the user what parser is being used.
Overrides:
getParserDescription in class XMLParserLiaisonDefault

checkXML4JVersion

public static void checkXML4JVersion()
                              throws WrongXML4JVersionException
Check the XML4J version number

parseXMLStream

public com.lotus.xsl.xml4j2tx.Document parseXMLStream(java.io.Reader reader,
                                                      java.lang.String filename)
                                               throws java.io.IOException,
                                                      XSLProcessorException
Parse the text pointed at by the reader as XML, and return a DOM Document interface. Implementation of XMLParserLiaison interface method.
Overrides:
parseXMLStream in class XMLParserLiaisonDefault

parseXMLStream

public com.lotus.xsl.xml4j2tx.Document parseXMLStream(java.net.URL url)
                                               throws java.io.IOException,
                                                      XSLProcessorException
Parse the text pointed at by the URL, and return a DOM Document interface. Implementation of XMLParserLiaison interface method.
Overrides:
parseXMLStream in class XMLParserLiaisonDefault

createDocument

public com.lotus.xsl.xml4j2tx.Document createDocument()
Create an empty DOM Document. Mainly used for creating an output document. Implementation of XMLParserLiaison interface method.
Overrides:
createDocument in class XMLParserLiaisonDefault

getNamespaceForPrefix

public java.lang.String getNamespaceForPrefix(java.lang.String prefix,
                                              com.lotus.xsl.xml4j2tx.Element namespaceContext)
Given a prefix and a namespace context, return the expanded namespace.

getLocalNameOfNode

public java.lang.String getLocalNameOfNode(org.w3c.dom.Node n)
Returns the local name of the given node.

getExpandedElementName

public java.lang.String getExpandedElementName(com.lotus.xsl.xml4j2tx.Element elem)
Returns the element name with the namespace expanded.

getExpandedAttributeName

public java.lang.String getExpandedAttributeName(com.lotus.xsl.xml4j2tx.Attr attr)
Returns the attribute name with the namespace expanded.

isIgnorableWhitespace

public boolean isIgnorableWhitespace(com.lotus.xsl.xml4j2tx.Text node)
Tell if the node is ignorable whitespace.

getParentOfNode

public org.w3c.dom.Node getParentOfNode(org.w3c.dom.Node node)
                                 throws java.lang.RuntimeException
Get the parent of a node.

getElementByID

public com.lotus.xsl.xml4j2tx.Element getElementByID(java.lang.String id,
                                                     com.lotus.xsl.xml4j2tx.Document doc)
Given an ID, return the element.

toMarkup

public void toMarkup(com.lotus.xsl.xml4j2tx.Document doc,
                     java.io.PrintWriter pw,
                     java.lang.String resultns,
                     boolean format)
              throws java.lang.Exception
Print the result tree.
Parameters:
doc - The result tree.
pw - The PrintWriter to print the contents to.
resultns - the value of the resultns attribute.
format - Tells if it should be pretty-printed.

getTreeAsText

public java.lang.String getTreeAsText(com.lotus.xsl.xml4j2tx.Document docTree)
                               throws java.io.IOException
Get a document Tree as a text string suiteable for display in a browser.

main

public static void main(java.lang.String[] argv)
Command line interfact to transform the XML according to the instructions found in the XSL document.