ErrorObserver
, MessageObserver
public class XSLTProcessor extends ErrorObserverAdapter implements MessageObserver
Modifier and Type | Field | Description |
---|---|---|
static java.lang.String |
ERR_OUTPUT_FLAG |
The flag directive for the error log file
-- added by Mohan Embar
|
static java.lang.String |
HELP_FLAG |
The flag directive for the help screen
|
static java.lang.String |
INDENT_SIZE |
Indent Size property name
|
static java.lang.String |
INPUT_FLAG |
The flag directive for the xml input file
|
static java.lang.String |
OUTPUT_FLAG |
The flag directive for the result tree output file
|
static java.lang.String |
STYLESHEET_FLAG |
The flag directive for the stylesheet to use
|
static java.lang.String |
VALIDATE_FLAG |
The flag directive for the turning on validation
|
static java.lang.String |
VERSION_FLAG |
The flag directive for displaying the version
|
FATAL, NORMAL, WARNING
Constructor | Description |
---|---|
XSLTProcessor() |
Creates a new XSLTProcessor
|
Modifier and Type | Method | Description |
---|---|---|
void |
addErrorObserver(ErrorObserver observer) |
Adds the given ErrorObserver to the list of ErrorObservers
for this processor
|
void |
addFunctionResolver(FunctionResolver fnResolver) |
Adds the given FunctionResolver used for resovling
extension functions.
|
void |
addMessageObserver(MessageObserver msgObserver) |
Adds the given MessageObserver to this processors list
of MessageObservers
|
static URILocation |
createURILocation(java.io.Reader reader,
java.lang.String filename) |
Creates a URILocation for the given Reader and Filename.
|
static java.lang.String |
getAppInfo() |
Retrieves the name and version of this application
|
XSLOutput |
getOutputProperties() |
Returns the XSLOutput object containing the
output properties.
|
java.lang.String |
getParameter(java.lang.String name) |
Returns the value of the top-level parameter
associated with the given name.
|
java.util.Enumeration |
getParameterNames() |
Returns an enumeration of all top-level parameter names.
|
java.lang.String |
getProperty(java.lang.String property) |
Returns the property value associated with the given String
|
static void |
main(java.lang.String[] args) |
Runs this XSLProcessor based on the given arguments.
|
org.w3c.dom.Document |
process(java.lang.String xmlFilename) |
Processes the specified xml file, using the stylesheet specified
by the xml stylesheet PI, and returns the resulting document.
|
void |
process(java.lang.String xmlFilename,
java.io.Writer out) |
Processes the specified xml file, using the stylesheet specified
by the xml stylesheet PI, and the default ResultHandler.
|
org.w3c.dom.Document |
process(java.lang.String xmlFilename,
java.lang.String xslFilename) |
Processes the specified xml file, using the specified xsl file.
|
void |
process(java.lang.String xmlFilename,
java.lang.String xslFilename,
java.io.Writer out) |
Processes the specified xml file, using the specified xsl file, and
the default ResultHandler.
|
void |
process(java.lang.String xmlFilename,
java.lang.String xslFilename,
ResultHandler handler) |
Processes the specified xml file, using the specified xsl file, and
the desired ResultHandler.
|
void |
process(java.lang.String xmlFilename,
XSLTStylesheet stylesheet,
java.io.Writer out) |
Processes the specified xml file, using the specified xsl file, and
the default ResultHandler.
|
void |
process(java.lang.String xmlFilename,
XSLTStylesheet stylesheet,
ResultHandler handler) |
Processes the specified xml file, using the specified xsl file, and
the desired ResultHandler.
|
org.w3c.dom.Document |
process(URILocation xmlLocation,
URILocation xslLocation) |
Processes the specified xml URILocation, using the specified xslt
stylesheet URILocation, and the desired ResultHandler.
|
void |
process(URILocation xmlLocation,
URILocation xslLocation,
ResultHandler handler) |
Processes the specified xml URILocation, using the specified xslt
stylesheet URILocation, and the desired ResultHandler.
|
void |
process(URILocation xmlLocation,
XSLTStylesheet stylesheet,
ResultHandler handler) |
Processes the specified xml URILocation, using the specified xslt
stylesheet, and the desired ResultHandler.
|
XPathNode |
process(XPathNode source,
XSLTStylesheet stylesheet) |
Processes the specified xml (DOM) Document, using the specified xsl
stylesheet.
|
void |
process(XPathNode source,
XSLTStylesheet stylesheet,
java.io.Writer out) |
Processes the specified xml (DOM) Document, using the specified xsl
stylesheet, and the default ResultHandler.
|
void |
process(XPathNode source,
XSLTStylesheet stylesheet,
ResultHandler handler) |
Processes the specified xml source node (XPathNode),
using the specified xsl stylesheet, and the desired ResultHandler.
|
org.w3c.dom.Document |
process(org.w3c.dom.Document xmlDocument,
XSLTStylesheet stylesheet) |
Processes the specified xml (DOM) Document, using the specified xsl
stylesheet.
|
void |
process(org.w3c.dom.Document xmlDocument,
XSLTStylesheet stylesheet,
java.io.Writer out) |
Processes the specified xml (DOM) Document, using the specified xsl
stylesheet, and the default ResultHandler.
|
void |
process(org.w3c.dom.Document xmlDocument,
XSLTStylesheet stylesheet,
ResultHandler handler) |
Processes the specified xml (DOM) Document, using the specified xsl
stylesheet, and the desired ResultHandler.
|
org.w3c.dom.Document |
process(org.w3c.dom.Document xmlDocument,
org.w3c.dom.Document xslDocument) |
Processes the specified xml (DOM) Document, using the specified
(DOM) xsl stylesheet.
|
void |
process(org.w3c.dom.Document xmlDocument,
org.w3c.dom.Document xslDocument,
java.io.Writer out) |
Processes the specified xml (DOM) Document, using the specified
xsl (DOM) Document and the default ResultHandler.
|
void |
process(org.w3c.dom.Document xmlDocument,
org.w3c.dom.Document xslDocument,
ResultHandler handler) |
Processes the specified xml (DOM) Document, using the specified
xsl (DOM) Document and the desired ResultHandler.
|
void |
receiveMessage(java.lang.String message) |
Recieves a message
|
void |
removeAllParameters() |
Removes all the top-level parameter bindings
|
void |
removeFunctionResolver(FunctionResolver fnResolver) |
Removes the given FunctionResolver from the list of
extension function resolvers.
|
MessageObserver |
removeMessageObserver(MessageObserver msgObserver) |
Removes the given MessageObserver from this processors list
of MessageObservers
|
void |
removeParameter(java.lang.String name) |
Removes the top-level parameter binding with the given name
|
void |
setDocumentBase(java.lang.String documentBase) |
Sets the document base for resolving relative URLs
|
void |
setDOMParser(DOMParser domParser) |
Sets the DOMParser that will be used to read in XML Documents
|
void |
setOutputProperties(XSLOutput output) |
Sets the XSLOutput object containing the
output properties.
|
void |
setParameter(java.lang.String name,
java.lang.String value) |
Sets a parameter which may be accessed using a top-level
parameter in the XSLT Stylesheet.
|
void |
setProperty(java.lang.String property,
java.lang.String value) |
Sets the property value associated with the given String.
|
void |
setURIResolver(URIResolver resolver) |
Sets the URIResolver for resolving all URIs.
|
void |
setValidation(boolean validate) |
Sets whether or not to validate when reading an XML document.
|
receiveError, receiveError, receiveError, receiveError, receiveError, receiveError, removeAllErrorObservers, removeErrorObserver
public static final java.lang.String HELP_FLAG
public static final java.lang.String INPUT_FLAG
public static final java.lang.String OUTPUT_FLAG
public static final java.lang.String STYLESHEET_FLAG
public static final java.lang.String VALIDATE_FLAG
public static final java.lang.String VERSION_FLAG
public static final java.lang.String ERR_OUTPUT_FLAG
public static final java.lang.String INDENT_SIZE
public void addErrorObserver(ErrorObserver observer)
addErrorObserver
in class ErrorObserverAdapter
observer
- the ErrorObserver to addpublic void addFunctionResolver(FunctionResolver fnResolver)
fnResolver
- the FunctionResolver to addorg.exolab.adaptx.xpath.FunctionResolver
public void addMessageObserver(MessageObserver msgObserver)
msgObserver
- the MessageObserver to add to this processors
list of MessageObserverspublic static java.lang.String getAppInfo()
public XSLOutput getOutputProperties()
public java.lang.String getParameter(java.lang.String name)
name
- the name of the top-level parameter whose value
should be returned.getParameterNames()
,
removeParameter(java.lang.String)
,
removeAllParameters()
,
setParameter(java.lang.String,java.lang.String)
public java.util.Enumeration getParameterNames()
getParameter(java.lang.String)
,
removeParameter(java.lang.String)
,
removeAllParameters()
,
setParameter(java.lang.String,java.lang.String)
public java.lang.String getProperty(java.lang.String property)
public static URILocation createURILocation(java.io.Reader reader, java.lang.String filename)
reader
- the Reader to create the URILocation forfilename
- , the absolute filename for the URILocationpublic static void main(java.lang.String[] args)
args
- a list of arguments to this XSLProcessor
public void process(java.lang.String xmlFilename, java.io.Writer out)
xmlFilename
- the path to the XML file to processout
- the Writer to print all processing results to.public org.w3c.dom.Document process(java.lang.String xmlFilename)
xmlFilename
- the path to the XML file to processpublic void process(java.lang.String xmlFilename, java.lang.String xslFilename, java.io.Writer out)
xmlFilename
- the href to the XML file to processxslFilename
- the href to the XSL file to use for processing.
This stylesheet will supercede any embedded stylesheets in the
xsl document. Set to null, to allow xml:stylesheet PI to be processed.out
- the Writer to print all processing results to.public void process(java.lang.String xmlFilename, XSLTStylesheet stylesheet, java.io.Writer out)
xmlFilename
- the href to the XML file to processstylesheet
- the XSLStylesheet to use for processing
This stylesheet will supercede any embedded stylesheets in the
xsl document. Set to null, to allow xml:stylesheet PI to be processed.out
- the Writer to print all processing results to.public void process(java.lang.String xmlFilename, java.lang.String xslFilename, ResultHandler handler)
xmlFilename
- the path to the XML file to processxslFilename
- the path to the XSL file to use for processing.
This stylesheet will supercede any embedded stylesheets in the
xsl document.handler
- the ResultHandler which handles the result tree.public void process(java.lang.String xmlFilename, XSLTStylesheet stylesheet, ResultHandler handler)
xmlFilename
- the path to the XML file to processstylesheet
- the XSLStylesheet to use for processing.
This stylesheet will supercede any embedded stylesheets in the
xsl document.handler
- the ResultHandler which handles the result tree.public org.w3c.dom.Document process(java.lang.String xmlFilename, java.lang.String xslFilename)
xmlFilename
- the path to the XML file to processxslFilename
- the path to the XSL file to use for processing.
This stylesheet will supercede any embedded stylesheets in the
xsl document.public org.w3c.dom.Document process(URILocation xmlLocation, URILocation xslLocation)
xmlLocation
- the URILocation for the input XML sourcexslLocation
- the URILocation for the stylesheet to use.
If present this stylesheet will supercede any embedded stylesheets
in the xml document. Set to null, to allow the xml:stylesheet PI to
be processed.public void process(URILocation xmlLocation, URILocation xslLocation, ResultHandler handler)
xmlLocation
- the URILocation for the input XML sourcexslLocation
- the URILocation for the stylesheet to use.
If present this stylesheet will supercede any embedded stylesheets
in the xml document. Set to null, to allow the xml:stylesheet PI to
be processed.handler
- the ResultHandler to use for processing the stylesheetpublic void process(URILocation xmlLocation, XSLTStylesheet stylesheet, ResultHandler handler)
xmlLocation
- the URILocation for the input XML sourcestylesheet
- the XSLTStylesheet to use (may be null).
If present this stylesheet will supercede any embedded stylesheets
in the xml document. Set to null, to allow the xml:stylesheet PI to
be processed.handler
- the ResultHandler to use for processing the stylesheetpublic org.w3c.dom.Document process(org.w3c.dom.Document xmlDocument, org.w3c.dom.Document xslDocument)
xmlDocument
- the XML Document to processxslDocument
- the XSL Document to use for processing.public void process(org.w3c.dom.Document xmlDocument, org.w3c.dom.Document xslDocument, java.io.Writer out)
xmlDocument
- the XML Document to processxslDocument
- the XSL Document to use for processing.out
- the Writer to print all processing results to.public void process(org.w3c.dom.Document xmlDocument, org.w3c.dom.Document xslDocument, ResultHandler handler)
xmlDocument
- the XML Document to processxslDocument
- the XSL Document to use for processing.out
- the PrintWriter to print all processing results to.handler
- the desired ResultHandler to use during processingpublic XPathNode process(XPathNode source, XSLTStylesheet stylesheet)
xmlDocument
- the XML Document to processstylesheet
- the XSLStylesheet to use for processing.public org.w3c.dom.Document process(org.w3c.dom.Document xmlDocument, XSLTStylesheet stylesheet)
xmlDocument
- the XML Document to processstylesheet
- the XSLStylesheet to use for processing.public void process(XPathNode source, XSLTStylesheet stylesheet, java.io.Writer out)
source
- the XML source node (XPathNode) to processstylesheet
- the XSLStylesheet to use for processing.out
- the Writer to print all processing results to.public void process(org.w3c.dom.Document xmlDocument, XSLTStylesheet stylesheet, java.io.Writer out)
xmlDocument
- the XML Document to processstylesheet
- the XSLStylesheet to use for processing.out
- the PrintWriter to print all processing results to.public void process(XPathNode source, XSLTStylesheet stylesheet, ResultHandler handler)
source
- the XML source node to processstylesheet
- the XSLStylesheet to use for processing.handler
- the ResultHandler to handle the result.public void process(org.w3c.dom.Document xmlDocument, XSLTStylesheet stylesheet, ResultHandler handler)
xmlDocument
- the XML Document to processstylesheet
- the XSLStylesheet to use for processing.handler
- the desired ResultHandler to use during processingpublic void receiveMessage(java.lang.String message)
receiveMessage
in interface MessageObserver
message
- the message to recieveMessageObserver
public void removeFunctionResolver(FunctionResolver fnResolver)
fnResolver
- the FunctionResolver to removeorg.exolab.adaptx.xpath.FunctionResolver
public MessageObserver removeMessageObserver(MessageObserver msgObserver)
msgObserver
- the MessageObserver to remove from this processors
list of MessageObserverspublic void removeParameter(java.lang.String name)
name
- the name of the parameter binding to removeremoveAllParameters()
,
setParameter(java.lang.String,java.lang.String)
public void removeAllParameters()
public void setDocumentBase(java.lang.String documentBase)
documentBase
- the document base to use while processing.public void setDOMParser(DOMParser domParser)
domParser
- the DOMParser that is to be used to read in
XML Documents
public void setOutputProperties(XSLOutput output)
output
- the XSLOutput object to set.public void setProperty(java.lang.String property, java.lang.String value)
public void setParameter(java.lang.String name, java.lang.String value)
name
- the name of the parametervalue
- the value of the parameterpublic void setURIResolver(URIResolver resolver)
resolver
- the URIResolver to usepublic void setValidation(boolean validate)
validate
- the boolean indicating whether to validate or not