com.lotus.xsl.xml4j
Class ProcessXSL

java.lang.Object
  |
  +--com.lotus.xsl.XMLParserLiaisonDefault
        |
        +--com.lotus.xsl.xml4j.ProcessXSL

public class ProcessXSL
extends XMLParserLiaisonDefault

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


Field Summary
 boolean m_canUseUserData
          This tells if it's all right to use the userdata field of nodes to store the expanded namespace in.
 boolean m_shouldExpandEntityRefs
          By default expand all entity references in the source and style trees.
 boolean m_supports_userData
           
 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
ProcessXSL()
          Construct an ProcessXSL instance, which implements the XMLProcessorLiaison interface.
ProcessXSL(com.lotus.xsl.xml4j.ErrorListener listener)
          Constructor that takes XML4J ErrorListener as an argument.
 
Method Summary
static void checkXML4JVersion()
          Check the XML4J version number
 com.lotus.xsl.xml4j.Document createDocument()
          Create an empty DOM Document.
 com.lotus.xsl.xml4j.Element getElementByID(java.lang.String id, com.lotus.xsl.xml4j.Document doc)
          Given an ID, return the element.
 java.lang.String getExpandedAttributeName(com.lotus.xsl.xml4j.Attr attr)
          Returns the attribute name with the namespace expanded.
 java.lang.String getExpandedElementName(com.lotus.xsl.xml4j.Element elem)
          Returns the element name with the namespace expanded.
 java.lang.String getLocalNameOfNode(com.lotus.xsl.xml4j.Node n)
          Returns the local name of the given node.
 java.lang.String getNamespaceForPrefix(java.lang.String prefix, com.lotus.xsl.xml4j.Element namespaceContext)
          Given a prefix and a namespace context, return the expanded namespace.
 com.lotus.xsl.xml4j.Node getParentOfNode(com.lotus.xsl.xml4j.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.xml4j.Document docTree)
          Get a document Tree as a text string suiteable for display in a browser.
 boolean isIgnorableWhitespace(com.lotus.xsl.xml4j.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.xml4j.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.xml4j.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.xml4j.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_supports_userData

public boolean m_supports_userData

m_canUseUserData

public boolean m_canUseUserData
This tells if it's all right to use the userdata field of nodes to store the expanded namespace in.

m_xml4jprint

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

ProcessXSL

public ProcessXSL(com.lotus.xsl.xml4j.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.

ProcessXSL

public ProcessXSL()
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.xml4j.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. May return null if not supported. It is recommended that you pass in some sort of recognizable name, such as the filename or URI, with which the reader can be recognized if the parse fails. Implementation of XMLParserLiaison interface method.
Parameters:
reader - A stream that should hold valid XML.
identifier - Used for diagnostic purposes only, some sort of identification for error reporting, may be null or empty string.
Throws:
java.io.IOException - thrown if unable to open the XML stream.
XSLProcessorException - thrown for all other error conditions.
Overrides:
parseXMLStream in class XMLParserLiaisonDefault

parseXMLStream

public com.lotus.xsl.xml4j.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.
Throws:
java.io.IOException - thrown if unable to open the XML stream.
XSLProcessorException - thrown for all other error conditions.
Overrides:
parseXMLStream in class XMLParserLiaisonDefault

createDocument

public com.lotus.xsl.xml4j.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.xml4j.Element namespaceContext)
Given a prefix and a namespace context, return the expanded namespace.

getLocalNameOfNode

public java.lang.String getLocalNameOfNode(com.lotus.xsl.xml4j.Node n)
Returns the local name of the given node.

getExpandedElementName

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

getExpandedAttributeName

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

isIgnorableWhitespace

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

getParentOfNode

public com.lotus.xsl.xml4j.Node getParentOfNode(com.lotus.xsl.xml4j.Node node)
                                         throws java.lang.RuntimeException
Get the parent of a node.

getElementByID

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

toMarkup

public void toMarkup(com.lotus.xsl.xml4j.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.
Throws:
java.lang.Exception - thrown if the result tree is corrupted.

getTreeAsText

public java.lang.String getTreeAsText(com.lotus.xsl.xml4j.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.