com.lotus.xsl
Class XSLProcessor

java.lang.Object
  |
  +--com.lotus.xsl.XSLProcessor

public class XSLProcessor
extends java.lang.Object
implements FormatterListener

It's the responsibility of the XSLProcessor class, collaborating with the XML parser liaison, the DOM, and the query/match engine, to transform a source tree of nodes into a result tree according to instructions and templates specified by a stylesheet tree. The methods process(...) are the primary public entry points. Look at the ProcessXSL class (com.lotus.xsl.xml4j) for an example of usage by the main() function.

You must create a new instance of the XSLProcessor class each time you run a transformation. Fixing this is high on my priority list.


Inner Class Summary
 class XSLProcessor.Stylesheet
          This class represents the base stylesheet or an "import" stylesheet.
 
Field Summary
static int EXITONPARSEERROR
           
 Formatter m_formatter
          The formatter interface, which has the toMarkup method, and which will eventually hold other non-event methods.
 com.lotus.xsl.Document m_resultTreeFactory
          The factory that will be used to create result tree fragments.
 boolean m_useATVsInSelects
           
static int NOREPORTPARSEERROR
           
static int REPORTPARSEERROR
           
 
Constructor Summary
XSLProcessor(java.lang.String xslURLString, XMLParserLiaison parserLiason)
          Construct an XSL processor that can call back to a XML processor, so it can handle included files, and the like, and do the initial parse of the XSL document.
XSLProcessor(XMLParserLiaison parserLiason)
          Construct an XSL processor that can call back to a XML processor, so it can handle included files, and the like.
 
Method Summary
 void cdata(char[] ch, int start, int length)
          Bottleneck the cdata event.
 void characters(char[] ch, int start, int length)
          Bottleneck the characters event.
 void comment(java.lang.String data)
          Bottleneck the comment event.
 void copyNamespaceAttributes(com.lotus.xsl.Node src, boolean srcIsStylesheetTree, com.lotus.xsl.AttributeListImpl destination)
          Copy xmlns: attributes in if not already in scope.
 void endDocument()
          Bottleneck the endDocument event.
 void endElement(java.lang.String name)
          Bottleneck the endElement event.
 void entityReference(java.lang.String name)
          Bottleneck the comment event.
 void error(com.lotus.xsl.Node styleNode, com.lotus.xsl.Node sourceNode, java.lang.String msg)
          Tell the user of an error, and probably throw an exception.
 void error(java.lang.String msg)
          Tell the user of an error, and probably throw an exception.
 java.lang.String fixWhiteSpace(java.lang.String string, boolean trimHead, boolean trimTail, boolean doublePunctuationSpaces)
          (Code stolen and modified from XML4J) Conditionally trim all leading and trailing whitespace in the specified String.
 java.util.Vector getKeyDeclarations()
          Get the table of KeyDeclaration objects.
 java.util.Hashtable getKeysTable()
          Get the table of element IDs.
 boolean getNeedToBuildKeysTable()
          Set the needToBuildKeysTable property, which, if true, will trigger the building of the keys table.
 ProblemListener getProblemListener()
          Get the problem listener property.
 QueryEngine getQueryEngine()
          Get the query/pattern-matcher object.
 java.util.Hashtable getSourceDocsTable()
          Get table of source tree documents.
 com.lotus.xsl.Node getSourceNode()
          Returns the current input node that is being processed.
 com.lotus.xsl.Node getSourceNode(java.lang.String selectPattern, com.lotus.xsl.Element namespaceContext)
          Returns the current input node that is being processed.
 java.util.Hashtable getStylesheetsTable()
          Get table of stylesheet documents.
 java.lang.String getStyleSheetURIfromDoc(com.lotus.xsl.Document sourceTree)
          Given a document, get the default stylesheet URI from the xsl:stylesheet PI.
 void ignorableWhitespace(char[] ch, int start, int length)
          Bottleneck the ignorableWhitespace event.
static boolean isSpace(char ch)
          Returns whether the specified ch conforms to the XML 1.0 definition of whitespace.
 boolean modifyStylesheetAttribute(com.lotus.xsl.Document styleSheet, java.lang.String nameOfIDAttr, java.lang.String idOfElementToModify, java.lang.String attrNameToSet, java.lang.String attrValueToSet)
          Given an id of a stylesheet element, search the tree for the element, and modify the named attribute on that element.
 com.lotus.xsl.Document parseXML(java.lang.String urlString, int howToHandleParseError)
          Read in the XML file.
 com.lotus.xsl.Document parseXML(java.lang.String urlString, java.lang.String[] holder)
          Take a user string and try and parse XML, and also return the url.
 com.lotus.xsl.Document parseXML(java.lang.String urlString, java.lang.String[] holder, java.lang.String base)
          Take a user string and try and parse XML, and also return the url.
 com.lotus.xsl.Document parseXML(java.net.URL url, int howToHandleParseError)
          Read in the XML file.
 long popDuration(java.lang.Object key)
          Returns the duration since pushTime was called, in milliseconds.
 com.lotus.xsl.Document process(com.lotus.xsl.Document sourceTree)
          Process a source document that contains a xml:stylesheet PI, transform the XML according to the instructions found in the XSL stylesheet pointed to by the PI.
 com.lotus.xsl.Document process(com.lotus.xsl.Document sourceTree, com.lotus.xsl.Document styleTree, java.lang.String styleBaseURI)
          Given the source and the style trees, transform the nodes according to the instructions found in the style tree.
 com.lotus.xsl.Document process(com.lotus.xsl.Document sourceTree, com.lotus.xsl.Document styleTree, java.lang.String styleBaseURI, com.lotus.xsl.Document out)
          Given the source and the style trees, transform the source according to the instructions found in the style document.
 void process(com.lotus.xsl.Document sourceTree, com.lotus.xsl.Document styleTree, java.lang.String styleBaseURI, java.io.PrintWriter resultWriter)
          Given the source and the style trees, transform the source according to the instructions found in the style document, and stream the result to a PrintWriter via the SAX-based FormatterListener.
 com.lotus.xsl.Document process(java.io.Reader xmlReader)
          Given a stream of XML, apply the stylesheet found in the document's stylesheet PI, and return the result as a DOM tree.
 void process(java.io.Reader xmlReader, java.io.PrintWriter writer)
          Given a stream of XML, stream the result to a PrintWriter via the SAX-based FormatterListener.
 com.lotus.xsl.Document process(java.io.Reader xmlReader, java.io.Reader xslReader, java.lang.String styleBaseURI)
          Given a stream of XML, and a stream of XSL, return the result as a DOM tree.
 void process(java.io.Reader xmlReader, java.io.Reader xslReader, java.lang.String styleBaseURI, java.io.PrintWriter writer)
          Given a stream of XML, and a stream of XSL, and stream the result to a PrintWriter via the SAX-based FormatterListener.
 com.lotus.xsl.Document process(java.lang.String xmldocURLString)
          Given a URI to a XML document, transform the XML according to the instructions found in the XSL.
 com.lotus.xsl.Document process(java.lang.String xmldocURLString, com.lotus.xsl.Document out)
          Given a URL to a XML document, transform the XML according to the instructions found in the XSL.
 com.lotus.xsl.Document process(java.lang.String xmldocURLString, java.lang.String xsldocURLString)
          Given a URI to a XML document and a URI to an XSL stylesheet, transform the XML according to the instructions found in the XSL.
 com.lotus.xsl.Document process(java.lang.String xmldocURLString, java.lang.String xsldocURLString, com.lotus.xsl.Document out)
          Given a URL to XML and XSL documents, transform the XML according to the instructions found in the XSL.
 void process(java.lang.String xmlurl, java.lang.String xslurl, java.lang.String outFileName)
          Given a URL to an XML document, and a URL to a XSL stylesheet, write the transformed result to a file.
 void process(java.lang.String xmldocURLString, java.lang.String xsldocURLString, java.lang.String writerName, java.io.PrintWriter pw)
          Given a URL to an XML document, and a URL to a XSL stylesheet, write the transformed result to a file.
 void processingInstruction(java.lang.String target, java.lang.String data)
          Bottleneck the processingInstruction event.
 void pushTime(java.lang.Object key)
          Mark the time, so that displayDuration can later display the elapse.
 void registerExtensionHandler(java.lang.String mimeType, DispatcherFactory factory)
          Register the given DispatcherFactor for a given mime type.
 void registerExtensionHandlerByName(java.lang.String classid, java.lang.String codetype)
          Given a classID and codetype, tr to register a code dispatcher.
 void setConstant(java.lang.String name, java.lang.String value)
          This special user function lets the caller set a defined constant, so they can dynamicaly give some control to a given stylesheet.
 void setDiagnosticsOutput(java.io.PrintWriter pw)
          If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream.
 void setDocumentLocator(com.lotus.xsl.Locator locator)
          To fullfill the FormatterListener interface...
 void setFormatter(Formatter formatter)
          Set the formatter interface, which has the toMarkup method, and which will eventually hold other non-event methods.
 void setKeyDeclarationsTable(java.util.Vector table)
          Set the table of KeyDeclaration objects, which are set by the xsl:key element.
 void setKeyTable(java.util.Hashtable table)
          Set the table of keys.
 void setNeedToBuildKeysTable(boolean b)
          Set needToBuildKeysTable to true if an xsl:key directive is found.
 void setOutputCarriageReturns(boolean b)
          Control if carriage returns are put in the result tree.
 void setOutputLinefeeds(boolean b)
          Control if linefeeds are put in the result tree.
 void setProblemListener(ProblemListener l)
          Set the problem listener property.
 void setQueryEngine(QueryEngine queryEngine)
          Set the query/pattern-matcher object.
 void setQuietConflictWarnings(boolean b)
          If the quietConflictWarnings property is set to true, warnings about pattern conflicts won't be printed to the diagnostics stream.
 void setSourceDocument(java.lang.String uri, com.lotus.xsl.Document doc)
          Set a source document.
 void setStripWhiteSpace(boolean b)
          This changes the default of the default-space attribute.
 void setStyleSheet(java.lang.String uri, com.lotus.xsl.Document doc, boolean shouldBuildTables)
          Not yet implemented! Set a stylesheet keyed by a URI.
 void setStylesheetParam(java.lang.String key, java.lang.String expression)
          Push a top-level stylesheet parameter.
 void setTraceSelect(boolean b)
          If this is set to true, simple traces of template calls are made.
 void setTraceTemplateChildren(boolean b)
          If this is set to true, debug diagnostics about template children as they are being constructed will be written to the m_diagnosticsPrintWriter stream.
 void setTraceTemplates(boolean b)
          If this is set to true, simple traces of template calls are made.
 void setTranslateCSS(boolean b)
          Deprecated.  
 boolean shouldStripSourceNode(com.lotus.xsl.Node textNode)
          Tells, through the combination of the default-space attribute on xsl:stylesheet, xsl:strip-space, xsl:preserve-space, and the xml:space attribute, whether or not extra whitespace should be stripped from the node.
 void startDocument()
          Bottleneck the startDocument event.
 void startElement(java.lang.String name)
          Bottleneck the startElement event.
 void startElement(java.lang.String name, com.lotus.xsl.AttributeList atts)
          Bottleneck the startElement event.
 void warn(com.lotus.xsl.Node styleNode, com.lotus.xsl.Node sourceNode, java.lang.String msg)
          Warn the user of an problem.
 void warn(java.lang.String msg)
          Warn the user of an problem.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_useATVsInSelects

public boolean m_useATVsInSelects

m_formatter

public Formatter m_formatter
The formatter interface, which has the toMarkup method, and which will eventually hold other non-event methods. Not to be confused with the DocumentHandler interface.

m_resultTreeFactory

public com.lotus.xsl.Document m_resultTreeFactory
The factory that will be used to create result tree fragments.

NOREPORTPARSEERROR

public static final int NOREPORTPARSEERROR

REPORTPARSEERROR

public static final int REPORTPARSEERROR

EXITONPARSEERROR

public static final int EXITONPARSEERROR
Constructor Detail

XSLProcessor

public XSLProcessor(XMLParserLiaison parserLiason)
Construct an XSL processor that can call back to a XML processor, so it can handle included files, and the like.

You must create a new instance of the XSLProcessor class each time you run a transformation. Fixing this is high on my priority list.

Parameters:
XMLParserLiaison - A liaison to an object that can help with stuff specific to a parser implementation.
See Also:
XMLParserLiaison, ProcessXSL

XSLProcessor

public XSLProcessor(java.lang.String xslURLString,
                    XMLParserLiaison parserLiason)
             throws java.lang.Exception
Construct an XSL processor that can call back to a XML processor, so it can handle included files, and the like, and do the initial parse of the XSL document.

You must create a new instance of the XSLProcessor class each time you run a transformation. Fixing this is high on my priority list.

Parameters:
xslURLString - A valid URI or filename.
XMLParserLiaison - A liaison to an object that can help with stuff specific to a parser implementation.
Throws:
java.lang.Exception - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.
See Also:
XMLParserLiaison, ProcessXSL
Method Detail

process

public com.lotus.xsl.Document process(com.lotus.xsl.Document sourceTree,
                                      com.lotus.xsl.Document styleTree,
                                      java.lang.String styleBaseURI,
                                      com.lotus.xsl.Document out)
                               throws XSLProcessorException,
                                      java.net.MalformedURLException,
                                      java.io.FileNotFoundException,
                                      java.io.IOException,
                                      com.lotus.xsl.SAXException
Given the source and the style trees, transform the source according to the instructions found in the style document.
Parameters:
sourceTree - The input DOM tree (immutable).
stylesheetTree - The XSL DOM tree (immutable).
styleBaseURI - A base URI from where to look for included and imported files.
out - The result tree, may be null.
Returns:
The result tree (same as the out param, if it was not null).
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

process

public void process(com.lotus.xsl.Document sourceTree,
                    com.lotus.xsl.Document styleTree,
                    java.lang.String styleBaseURI,
                    java.io.PrintWriter resultWriter)
             throws XSLProcessorException,
                    java.net.MalformedURLException,
                    java.io.FileNotFoundException,
                    java.io.IOException,
                    com.lotus.xsl.SAXException
Given the source and the style trees, transform the source according to the instructions found in the style document, and stream the result to a PrintWriter via the SAX-based FormatterListener.
Parameters:
sourceTree - The input DOM tree (immutable).
stylesheetTree - The XSL DOM tree (immutable).
styleBaseURI - A base URI from where to look for included and imported files.
resultWriter - The stream where you wish the result tree to be written.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

process

public com.lotus.xsl.Document process(com.lotus.xsl.Document sourceTree,
                                      com.lotus.xsl.Document styleTree,
                                      java.lang.String styleBaseURI)
                               throws XSLProcessorException,
                                      java.net.MalformedURLException,
                                      java.io.FileNotFoundException,
                                      java.io.IOException,
                                      com.lotus.xsl.SAXException
Given the source and the style trees, transform the nodes according to the instructions found in the style tree.
Parameters:
sourceTree - The input DOM tree (immutable).
stylesheetTree - The XSL DOM tree (immutable).
styleBaseURI - A base URI from where to look for included and imported files.
Returns:
The result tree.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

process

public com.lotus.xsl.Document process(com.lotus.xsl.Document sourceTree)
                               throws XSLProcessorException,
                                      java.net.MalformedURLException,
                                      java.io.FileNotFoundException,
                                      java.io.IOException,
                                      com.lotus.xsl.SAXException
Process a source document that contains a xml:stylesheet PI, transform the XML according to the instructions found in the XSL stylesheet pointed to by the PI.
Parameters:
sourceTree - The input DOM tree (immutable).
Returns:
The result tree.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

process

public com.lotus.xsl.Document process(java.lang.String xmldocURLString,
                                      java.lang.String xsldocURLString,
                                      com.lotus.xsl.Document out)
                               throws XSLProcessorException,
                                      java.net.MalformedURLException,
                                      java.io.FileNotFoundException,
                                      java.io.IOException,
                                      com.lotus.xsl.SAXException
Given a URL to XML and XSL documents, transform the XML according to the instructions found in the XSL. Requires parseXSLRoot to have been called, either directly or indirectly (anytime you hand in a XSL URL, parseXSLRoot is called).
Parameters:
xmldocURLString - The URI to the input XML document.
xsldocURLString - The URI to the XSL stylesheet.
out - The result tree, may be null.
Returns:
The result tree (same as the out param, if it was not null).
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

process

public com.lotus.xsl.Document process(java.lang.String xmldocURLString,
                                      com.lotus.xsl.Document out)
                               throws XSLProcessorException,
                                      java.net.MalformedURLException,
                                      java.io.FileNotFoundException,
                                      java.io.IOException,
                                      com.lotus.xsl.SAXException
Given a URL to a XML document, transform the XML according to the instructions found in the XSL. Requires that the XML have a stylesheet PI in it of type 'text/xsl'.
Parameters:
xmldocURLString - The URI to the input XML document.
out - The result tree, may be null.
Returns:
The result tree (same as the out param, if it was not null).
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

process

public void process(java.lang.String xmlurl,
                    java.lang.String xslurl,
                    java.lang.String outFileName)
             throws XSLProcessorException,
                    java.net.MalformedURLException,
                    java.io.FileNotFoundException,
                    java.io.IOException,
                    com.lotus.xsl.SAXException
Given a URL to an XML document, and a URL to a XSL stylesheet, write the transformed result to a file.
Parameters:
xmldocURLString - The URI to the input XML document.
xsldocURLString - The URI to the XSL stylesheet.
outFileName - The name of the file to write to.
Returns:
The result tree.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

process

public void process(java.lang.String xmldocURLString,
                    java.lang.String xsldocURLString,
                    java.lang.String writerName,
                    java.io.PrintWriter pw)
             throws XSLProcessorException,
                    java.net.MalformedURLException,
                    java.io.FileNotFoundException,
                    java.io.IOException,
                    com.lotus.xsl.SAXException
Given a URL to an XML document, and a URL to a XSL stylesheet, write the transformed result to a file.
Parameters:
xmldocURLString - The URI to the input XML document.
xsldocURLString - The URI to the XSL stylesheet.
displayName - The name of the stream for diagnostics.
pw - A PrintWriter to write the results to.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

process

public com.lotus.xsl.Document process(java.lang.String xmldocURLString,
                                      java.lang.String xsldocURLString)
                               throws XSLProcessorException,
                                      java.net.MalformedURLException,
                                      java.io.FileNotFoundException,
                                      java.io.IOException,
                                      com.lotus.xsl.SAXException
Given a URI to a XML document and a URI to an XSL stylesheet, transform the XML according to the instructions found in the XSL.
Parameters:
xmldocURLString - The URI to the input XML document.
xsldocURLString - The URI to the XSL stylesheet.
Returns:
The result tree.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

process

public com.lotus.xsl.Document process(java.lang.String xmldocURLString)
                               throws XSLProcessorException,
                                      java.net.MalformedURLException,
                                      java.io.FileNotFoundException,
                                      java.io.IOException,
                                      com.lotus.xsl.SAXException
Given a URI to a XML document, transform the XML according to the instructions found in the XSL. Requires that the document contain a stylesheet PI.
Parameters:
xmldocURLString - The URL to the input XML document.
Returns:
The result tree.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

process

public void process(java.io.Reader xmlReader,
                    java.io.Reader xslReader,
                    java.lang.String styleBaseURI,
                    java.io.PrintWriter writer)
             throws XSLProcessorException,
                    java.net.MalformedURLException,
                    java.io.FileNotFoundException,
                    java.io.IOException,
                    com.lotus.xsl.SAXException
Given a stream of XML, and a stream of XSL, and stream the result to a PrintWriter via the SAX-based FormatterListener.
Parameters:
xmlReader - A reader for XML.
xslReader - A reader for XSL.
styleBaseURI - The base directory from where to find included stylesheets.
writer - The writer that will receive the result XML.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

process

public void process(java.io.Reader xmlReader,
                    java.io.PrintWriter writer)
             throws XSLProcessorException,
                    java.net.MalformedURLException,
                    java.io.FileNotFoundException,
                    java.io.IOException,
                    com.lotus.xsl.SAXException
Given a stream of XML, stream the result to a PrintWriter via the SAX-based FormatterListener. Requires that the source XML contain a stylesheet PI of type 'text/xsl'.
Parameters:
xmlReader - A reader for XML.
writer - The writer that will receive the result XML.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

process

public com.lotus.xsl.Document process(java.io.Reader xmlReader,
                                      java.io.Reader xslReader,
                                      java.lang.String styleBaseURI)
                               throws XSLProcessorException,
                                      java.net.MalformedURLException,
                                      java.io.FileNotFoundException,
                                      java.io.IOException,
                                      com.lotus.xsl.SAXException
Given a stream of XML, and a stream of XSL, return the result as a DOM tree.
Parameters:
xmlReader - A reader for XML.
xslReader - A reader for XSL.
styleBaseURI - The base directory from where to find included stylesheets.
Returns:
The result tree.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

process

public com.lotus.xsl.Document process(java.io.Reader xmlReader)
                               throws XSLProcessorException,
                                      java.net.MalformedURLException,
                                      java.io.FileNotFoundException,
                                      java.io.IOException,
                                      com.lotus.xsl.SAXException
Given a stream of XML, apply the stylesheet found in the document's stylesheet PI, and return the result as a DOM tree.
Parameters:
xmlReader - A reader for XML.
Returns:
The result tree.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

parseXML

public com.lotus.xsl.Document parseXML(java.lang.String urlString,
                                       java.lang.String[] holder)
                                throws XSLProcessorException,
                                       java.net.MalformedURLException,
                                       java.io.FileNotFoundException,
                                       java.io.IOException
Take a user string and try and parse XML, and also return the url.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

parseXML

public com.lotus.xsl.Document parseXML(java.lang.String urlString,
                                       java.lang.String[] holder,
                                       java.lang.String base)
                                throws XSLProcessorException,
                                       java.net.MalformedURLException,
                                       java.io.FileNotFoundException,
                                       java.io.IOException
Take a user string and try and parse XML, and also return the url.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

parseXML

public com.lotus.xsl.Document parseXML(java.lang.String urlString,
                                       int howToHandleParseError)
                                throws XSLProcessorException,
                                       java.net.MalformedURLException,
                                       java.io.FileNotFoundException,
                                       java.io.IOException
Read in the XML file.
Parameters:
urlString - Pointer to a XML-complient file.
howToHandleParseError - One of NOREPORTPARSEERROR, REPORTPARSEERROR,EXITONPARSEERROR.
baseURL - returns the base URL.
Returns:
lcom.ms.xml.om.Document object, which represents the parsed XML.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

parseXML

public com.lotus.xsl.Document parseXML(java.net.URL url,
                                       int howToHandleParseError)
                                throws XSLProcessorException,
                                       java.net.MalformedURLException,
                                       java.io.FileNotFoundException,
                                       java.io.IOException
Read in the XML file.
Parameters:
urlString - Pointer to a XML-complient file.
howToHandleParseError - One of NOREPORTPARSEERROR, REPORTPARSEERROR,EXITONPARSEERROR.
baseURL - returns the base URL.
Returns:
lcom.ms.xml.om.Document object, which represents the parsed XML.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

getStylesheetsTable

public java.util.Hashtable getStylesheetsTable()
Get table of stylesheet documents. Document objects are keyed by URL string.

setStyleSheet

public void setStyleSheet(java.lang.String uri,
                          com.lotus.xsl.Document doc,
                          boolean shouldBuildTables)
                   throws XSLProcessorException
Not yet implemented! Set a stylesheet keyed by a URI. Every time encountering an xsl:import or xsl:include element the processor will first consult table of supplied documents before trying to load and parse the corresponding document from the Net. This could be useful from several points of view: - frequently used documents would be loaded and parsed just once - the performance of XSL based applications could be improved. - programmatically constructed documents could be used for import and inclusion. - XSL stylesheet could be parametrized with respect to their imports and includes; this means that decision which particular document needs to be imported or included could be postponed till actual application of a stylesheet to an XML document; XSL stylesheets could be authored with dummy URIs for imports and includes - these URIs would play role of parameters that are resulved every time the stylesheet is applied; decision which particular value to give to wich parameter would be made by an application program, not by author of the stylesheet.
Parameters:
uri - A unique URI.
doc - A DOM tree that is an XSL stylesheet.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

getSourceDocsTable

public java.util.Hashtable getSourceDocsTable()
Get table of source tree documents. Document objects are keyed by URL string.

setSourceDocument

public void setSourceDocument(java.lang.String uri,
                              com.lotus.xsl.Document doc)
Set a source document. Every time a source document is requested through either xsl:uri or in a process call, the processor will first consult table of supplied documents before trying to load and parse the corresponding document from the Net.

warn

public void warn(java.lang.String msg)
          throws XSLProcessorException
Warn the user of an problem.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

warn

public void warn(com.lotus.xsl.Node styleNode,
                 com.lotus.xsl.Node sourceNode,
                 java.lang.String msg)
          throws XSLProcessorException
Warn the user of an problem.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

error

public void error(java.lang.String msg)
           throws XSLProcessorException
Tell the user of an error, and probably throw an exception.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

error

public void error(com.lotus.xsl.Node styleNode,
                  com.lotus.xsl.Node sourceNode,
                  java.lang.String msg)
           throws XSLProcessorException
Tell the user of an error, and probably throw an exception.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

pushTime

public void pushTime(java.lang.Object key)
Mark the time, so that displayDuration can later display the elapse.

popDuration

public long popDuration(java.lang.Object key)
Returns the duration since pushTime was called, in milliseconds.

setDiagnosticsOutput

public void setDiagnosticsOutput(java.io.PrintWriter pw)
If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream. If the value is null, then diagnostics will be turned off.

setTraceTemplates

public void setTraceTemplates(boolean b)
If this is set to true, simple traces of template calls are made.

setTraceSelect

public void setTraceSelect(boolean b)
If this is set to true, simple traces of template calls are made.

setTraceTemplateChildren

public void setTraceTemplateChildren(boolean b)
If this is set to true, debug diagnostics about template children as they are being constructed will be written to the m_diagnosticsPrintWriter stream. diagnoseTemplateChildren is false by default.

setQuietConflictWarnings

public void setQuietConflictWarnings(boolean b)
If the quietConflictWarnings property is set to true, warnings about pattern conflicts won't be printed to the diagnostics stream. True by default.
Parameters:
b - true if conflict warnings should be suppressed.

setDocumentLocator

public void setDocumentLocator(com.lotus.xsl.Locator locator)
To fullfill the FormatterListener interface... not action for the moment.

startDocument

public void startDocument()
                   throws com.lotus.xsl.SAXException
Bottleneck the startDocument event.

endDocument

public void endDocument()
                 throws com.lotus.xsl.SAXException
Bottleneck the endDocument event.

startElement

public void startElement(java.lang.String name)
                  throws com.lotus.xsl.SAXException
Bottleneck the startElement event.

startElement

public void startElement(java.lang.String name,
                         com.lotus.xsl.AttributeList atts)
                  throws com.lotus.xsl.SAXException
Bottleneck the startElement event.

endElement

public void endElement(java.lang.String name)
                throws com.lotus.xsl.SAXException
Bottleneck the endElement event.

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws com.lotus.xsl.SAXException
Bottleneck the characters event.

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws com.lotus.xsl.SAXException
Bottleneck the ignorableWhitespace event.

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws com.lotus.xsl.SAXException
Bottleneck the processingInstruction event.

comment

public void comment(java.lang.String data)
             throws com.lotus.xsl.SAXException
Bottleneck the comment event.
Specified by:
comment in interface FormatterListener

entityReference

public void entityReference(java.lang.String name)
                     throws com.lotus.xsl.SAXException
Bottleneck the comment event.
Specified by:
entityReference in interface FormatterListener

cdata

public void cdata(char[] ch,
                  int start,
                  int length)
           throws com.lotus.xsl.SAXException
Bottleneck the cdata event.
Specified by:
cdata in interface FormatterListener

copyNamespaceAttributes

public void copyNamespaceAttributes(com.lotus.xsl.Node src,
                                    boolean srcIsStylesheetTree,
                                    com.lotus.xsl.AttributeListImpl destination)
Copy xmlns: attributes in if not already in scope.

setTranslateCSS

public void setTranslateCSS(boolean b)
Deprecated.  
Translate CSS attributes on the output to a "style" attribute, for old submission support. You probably shouldn't rely on this, though I personally like it a lot.
Parameters:
b - If true, translate CSS attributes on the output to a "style" attribute.

setStripWhiteSpace

public void setStripWhiteSpace(boolean b)
This changes the default of the default-space attribute.
Parameters:
b - Sets the default of the default-space attribute to "strip" if true, or "preserve" if false.

shouldStripSourceNode

public boolean shouldStripSourceNode(com.lotus.xsl.Node textNode)
Tells, through the combination of the default-space attribute on xsl:stylesheet, xsl:strip-space, xsl:preserve-space, and the xml:space attribute, whether or not extra whitespace should be stripped from the node. Literal elements from template elements should not be tested with this function.
Parameters:
textNode - A text node from the source tree.
Returns:
true if the text node should be stripped of extra whitespace.

isSpace

public static boolean isSpace(char ch)
Returns whether the specified ch conforms to the XML 1.0 definition of whitespace. Refer to the definition of S for details.
Parameters:
ch - Character to check as XML whitespace.
Returns:
=true if ch is XML whitespace; otherwise =false.

fixWhiteSpace

public java.lang.String fixWhiteSpace(java.lang.String string,
                                      boolean trimHead,
                                      boolean trimTail,
                                      boolean doublePunctuationSpaces)
(Code stolen and modified from XML4J) Conditionally trim all leading and trailing whitespace in the specified String. All strings of white space are replaced by a single space character (#x20), except spaces after punctuation which receive double spaces if doublePunctuationSpaces is true. This function may be useful to a formatter, but to get first class results, the formatter should probably do it's own white space handling based on the semantics of the formatting object.
Parameters:
string - String to be trimmed.
trimHead - Trim leading whitespace?
trimTail - Trim trailing whitespace?
doublePunctuationSpaces - Use double spaces for punctuation?
Returns:
The trimmed string.

setOutputCarriageReturns

public void setOutputCarriageReturns(boolean b)
Control if carriage returns are put in the result tree. Default is to output carriage returns.
Parameters:
b - If true, output carriage returns.

setOutputLinefeeds

public void setOutputLinefeeds(boolean b)
Control if linefeeds are put in the result tree. Default is to output linefeeds.
Parameters:
b - If true, output linefeeds.

getStyleSheetURIfromDoc

public java.lang.String getStyleSheetURIfromDoc(com.lotus.xsl.Document sourceTree)
Given a document, get the default stylesheet URI from the xsl:stylesheet PI.

setConstant

public void setConstant(java.lang.String name,
                        java.lang.String value)
This special user function lets the caller set a defined constant, so they can dynamicaly give some control to a given stylesheet.

setStylesheetParam

public void setStylesheetParam(java.lang.String key,
                               java.lang.String expression)
Push a top-level stylesheet parameter. This value can be evaluated via xsl:param-variable.

modifyStylesheetAttribute

public boolean modifyStylesheetAttribute(com.lotus.xsl.Document styleSheet,
                                         java.lang.String nameOfIDAttr,
                                         java.lang.String idOfElementToModify,
                                         java.lang.String attrNameToSet,
                                         java.lang.String attrValueToSet)
                                  throws XSLProcessorException
Given an id of a stylesheet element, search the tree for the element, and modify the named attribute on that element.
Parameters:
styleSheet - The stylesheet to look in.
nameOfIDAttr - The name of an attribute to search for a unique id.
idOfElementToModify - The unique ID to look for.
attrNameToSet - Once the element is found, the name of the attribute to set.
attrValueToSet - The value to set the attribute to.
Returns:
true if modification was made. False otherwise.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

getSourceNode

public com.lotus.xsl.Node getSourceNode()
Returns the current input node that is being processed.

getSourceNode

public com.lotus.xsl.Node getSourceNode(java.lang.String selectPattern,
                                        com.lotus.xsl.Element namespaceContext)
                                 throws XSLProcessorException,
                                        java.net.MalformedURLException,
                                        java.io.FileNotFoundException,
                                        java.io.IOException
Returns the current input node that is being processed.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

registerExtensionHandlerByName

public void registerExtensionHandlerByName(java.lang.String classid,
                                           java.lang.String codetype)
                                    throws XSLProcessorException
Given a classID and codetype, tr to register a code dispatcher.

registerExtensionHandler

public void registerExtensionHandler(java.lang.String mimeType,
                                     DispatcherFactory factory)
Register the given DispatcherFactor for a given mime type.

setFormatter

public void setFormatter(Formatter formatter)
                  throws com.lotus.xsl.SAXException
Set the formatter interface, which has the toMarkup method, and which will eventually hold other non-event methods. Not to be confused with the DocumentHandler interface.

setQueryEngine

public void setQueryEngine(QueryEngine queryEngine)
Set the query/pattern-matcher object.
Parameters:
queryEngine - A QueryEngine interface.

getQueryEngine

public QueryEngine getQueryEngine()
Get the query/pattern-matcher object.
Returns:
The QueryEngine interface.

setKeyDeclarationsTable

public void setKeyDeclarationsTable(java.util.Vector table)
Set the table of KeyDeclaration objects, which are set by the xsl:key element.
Parameters:
table - Table of IDAttributeHolder objects.

getKeyDeclarations

public java.util.Vector getKeyDeclarations()
Get the table of KeyDeclaration objects.
Returns:
Table of KeyDeclaration objects.

setKeyTable

public void setKeyTable(java.util.Hashtable table)
Set the table of keys. This will be used by the key() and keyref() functions for lookup of a nodelist.

getKeysTable

public java.util.Hashtable getKeysTable()
Get the table of element IDs. This table is used by the id() functions for lookup of an element ID.
Returns:
Table of element IDs, keyed by ID string, with values that are Element nodes.

setNeedToBuildKeysTable

public void setNeedToBuildKeysTable(boolean b)
Set needToBuildKeysTable to true if an xsl:key directive is found. Mainly for use by the XMLParserLiaison classes for optimized processing of keys.

getNeedToBuildKeysTable

public boolean getNeedToBuildKeysTable()
Set the needToBuildKeysTable property, which, if true, will trigger the building of the keys table. Mainly for use by the XMLParserLiaison classes for optimized processing of keys.

setProblemListener

public void setProblemListener(ProblemListener l)
Set the problem listener property. The XSL class can have a single listener that can be informed of errors and warnings, and can normally control if an exception is thrown or not (or the problem listeners can throw their own RuntimeExceptions).
Parameters:
l - A ProblemListener interface.

getProblemListener

public ProblemListener getProblemListener()
Get the problem listener property. The XSL class can have a single listener that can be informed of errors and warnings, and can normally control if an exception is thrown or not (or the problem listeners can throw their own RuntimeExceptions).
Returns:
A ProblemListener interface.