|
BEA Systems, Inc. | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weblogic.apache.xalan.xslt.XSLTEngineImpl
The Xalan workhorse -- Collaborates with the XML parser liaison, the DOM, and the XPath engine, to transform a source tree of nodes into a result tree according to instructions and templates specified by a stylesheet tree. We suggest you use one of the static XSLTProcessorFactory getProcessor() methods to instantiate the processor and return an interface that greatly simplifies the process of manipulating XSLTEngineImpl.
The methods process(...)
are the primary public entry points.
The best way to perform transformations is to use the
XSLTProcessor.process(weblogic.apache.xalan.xslt.XSLTInputSource, weblogic.apache.xalan.xslt.XSLTInputSource, weblogic.apache.xalan.xslt.XSLTResultTarget)
method,
but you may use any of process methods defined in XSLTEngineImpl.
Please note that this class is not safe per instance over multiple threads. If you are in a multithreaded environment, you should keep a pool of these objects, or create a new one each time. In a multithreaded environment, the right way to do things is to create a StylesheetRoot via processStylesheet, and then reuse this object over multiple threads.
If you reuse the processor instance, you should call reset() between transformations.
This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.
XSLTProcessorFactory
,
XSLTProcessor
Constructor Summary | |
protected |
XSLTEngineImpl()
Deprecated. Construct an XSLT processor that uses the default DTM (Document Table Model) liaison and XML parser. |
|
XSLTEngineImpl(java.lang.String liaisonClassName)
Deprecated. Construct an XSLT processor that uses the the given parser liaison. |
|
XSLTEngineImpl(XMLParserLiaison parserLiaison)
Deprecated. Construct an XSL processor that uses the the given parser liaison. |
Method Summary | |
void |
addTraceListener(TraceListener tl)
Deprecated. Add a trace listener for the purposes of debugging and diagnosis. |
void |
characters(char[] ch,
int start,
int length)
Deprecated. Receive notification of character data. |
void |
comment(char[] ch,
int start,
int length)
Deprecated. Report an XML comment anywhere in the document. |
XMLParserLiaison |
createLiaison()
Deprecated. Get a Liaison class |
StylesheetRoot |
createStylesheetRoot(java.lang.String baseIdentifier)
Deprecated. Bottleneck the creation of the stylesheet for derivation purposes. |
XBoolean |
createXBoolean(boolean b)
Deprecated. Convenience function to create an XBoolean. |
XNodeSet |
createXNodeSet(org.w3c.dom.Node n)
Deprecated. Convenience function to create an XNodeSet from a node. |
XNodeSet |
createXNodeSet(org.w3c.dom.NodeList nl)
Deprecated. Convenience function to create an XNodeSet. |
XNull |
createXNull()
Deprecated. Convenience function to create an XNull. |
XNumber |
createXNumber(double d)
Deprecated. Convenience function to create an XNumber. |
XObject |
createXObject(java.lang.Object o)
Deprecated. Convenience function to create an XObject. |
XString |
createXString(java.lang.String s)
Deprecated. Convenience function to create an XString. |
protected void |
diag(java.lang.String s)
Deprecated. Bottleneck output of diagnostics. |
protected void |
displayDuration(java.lang.String info,
java.lang.Object key)
Deprecated. Display the duration since pushTime was called. |
void |
endCDATA()
Deprecated. Report the end of a CDATA section. |
void |
endDocument()
Deprecated. Receive notification of the end of a document. |
void |
endDTD()
Deprecated. Report the end of DTD declarations. |
void |
endElement(java.lang.String name)
Deprecated. Receive notification of the end of an element. |
void |
endEntity(java.lang.String name)
Deprecated. Report the end of an entity. |
void |
error(int msg)
Deprecated. Tell the user of an error, and probably throw an exception. |
void |
error(int msg,
java.lang.Exception e)
Deprecated. Tell the user of an error, and probably throw an exception. |
void |
error(int msg,
java.lang.Object[] args)
Deprecated. Tell the user of an error, and probably throw an exception. |
void |
error(int msg,
java.lang.Object[] args,
java.lang.Exception e)
Deprecated. Tell the user of an error, and probably throw an exception. |
void |
error(org.w3c.dom.Node styleNode,
org.w3c.dom.Node sourceNode,
int msg)
Deprecated. Tell the user of an error, and probably throw an exception. |
void |
error(org.w3c.dom.Node styleNode,
org.w3c.dom.Node sourceNode,
int msg,
java.lang.Object[] args)
Deprecated. Tell the user of an error, and probably throw an exception. |
void |
error(java.lang.String msg)
Deprecated. Tell the user of an error, and probably throw an exception. |
StylesheetSpec |
getAssociatedStylesheet(XSLTInputSource source,
java.lang.String media,
java.lang.String charset)
Deprecated. Get the preferred stylesheet for the XSLTInputSource XML document, as identified by the xml-stylesheet PI, and matching the media and charset criteria. |
java.util.Vector |
getAssociatedStylesheets(XSLTInputSource source,
java.lang.String media,
java.lang.String charset)
Deprecated. Get a list of stylesheet specifications for the XSLTInputSource XML document, as identified by the xml-stylesheet PI, and matching the media and charset criteria. |
org.xml.sax.DocumentHandler |
getDocumentHandler()
Deprecated. Get the current SAX DocumentHandler (the same object as the FormatterListener), or null if none has been set. |
org.xml.sax.DocumentHandler |
getFormatterListener()
Deprecated. Get the current FormatterListener (SAX DocumentHandler), or null if none has been set. |
java.lang.String |
getOutputFileName()
Deprecated. Get the filename of the output document, if it was set. |
ProblemListener |
getProblemListener()
Deprecated. Get the problem listener property. |
org.w3c.dom.Node |
getSourceTreeFromInput(XSLTInputSource inputSource)
Deprecated. Given an input source, get the source tree. |
StylesheetRoot |
getStylesheet()
Deprecated. Get the current stylesheet for this processor. |
TransformerImpl |
getTransformer()
Deprecated. |
TransformerFactoryImpl |
getTransformerFactory()
Deprecated. |
static java.net.URL |
getURLFromString(java.lang.String urlString,
java.lang.String base)
Deprecated. Take a user string and try and parse XML, and also return the url. |
XMLParserLiaison |
getXMLProcessorLiaison()
Deprecated. Get the XMLParserLiaison that this processor uses. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Deprecated. Receive notification of ignorable whitespace in element content. |
void |
message(org.w3c.dom.Node styleNode,
org.w3c.dom.Node sourceNode,
java.lang.String msg)
Deprecated. Warn the user of an problem. |
void |
message(java.lang.String msg)
Deprecated. Warn the user of an problem. |
void |
process(XSLTInputSource inputSource,
XSLTInputSource stylesheetSource,
XSLTResultTarget outputTarget)
Deprecated. Transform the source tree to the output in the given result tree target. |
void |
processingInstruction(java.lang.String target,
java.lang.String data)
Deprecated. Receive notification of a processing instruction. |
StylesheetRoot |
processStylesheet(java.lang.String xsldocURLString)
Deprecated. Given a URI to an XSL stylesheet, Compile the stylesheet into an internal representation. |
StylesheetRoot |
processStylesheet(XSLTInputSource stylesheetSource)
Deprecated. Given a URI to an XSL stylesheet, Compile the stylesheet into an internal representation. |
void |
removeTraceListener(TraceListener tl)
Deprecated. Remove a trace listener. |
void |
reset()
Deprecated. Reset the state. |
void |
setDiagnosticsOutput(java.io.OutputStream out)
Deprecated. If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream. |
void |
setDiagnosticsOutput(java.io.PrintWriter pw)
Deprecated. If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream. |
void |
setDocumentHandler(org.xml.sax.DocumentHandler listener)
Deprecated. Set the current SAX DocumentHandler (the same object as the FormatterListener). |
void |
setDocumentLocator(org.xml.sax.Locator locator)
Deprecated. Receive an object for locating the origin of SAX document events. |
void |
setFormatterListener(org.xml.sax.DocumentHandler flistener)
Deprecated. Set the FormatterListener (the SAX DocumentHandler). |
void |
setOutputFileName(java.lang.String filename)
Deprecated. Set the filename of the output document. |
void |
setOutputStream(java.io.OutputStream os)
Deprecated. Set the output stream. |
void |
setParameter(java.lang.String key,
java.lang.Object value)
Deprecated. Set a top-level stylesheet parameter. |
void |
setProblemListener(ProblemListener l)
Deprecated. Set the problem listener property. |
void |
setQuietConflictWarnings(boolean b)
Deprecated. If set to true (the default), pattern conflict warnings are not printed to the diagnostics stream. |
void |
setStylesheet(StylesheetRoot stylesheetRoot)
Deprecated. Set the stylesheet for this processor. |
void |
setStylesheetParam(java.lang.String key,
java.lang.String expression)
Deprecated. Set a top-level stylesheet parameter. |
void |
setStylesheetParam(java.lang.String key,
XObject value)
Deprecated. Submit a top-level stylesheet parameter. |
void |
setTraceSelect(boolean b)
Deprecated. If this is set to true, simple traces of template calls are made. |
void |
setTraceTemplateChildren(boolean b)
Deprecated. 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)
Deprecated. If this is set to true, simple traces of template calls are made. |
void |
startCDATA()
Deprecated. Report the start of a CDATA section. |
void |
startDocument()
Deprecated. Receive notification of the beginning of a document. |
void |
startDTD(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId)
Deprecated. Report the start of DTD declarations, if any. |
void |
startElement(java.lang.String name,
org.xml.sax.AttributeList atts)
Deprecated. Receive notification of the beginning of an element. |
void |
startEntity(java.lang.String name)
Deprecated. |
void |
warn(int msg)
Deprecated. Warn the user of an problem. |
void |
warn(int msg,
java.lang.Object[] args)
Deprecated. Warn the user of an problem. |
void |
warn(org.w3c.dom.Node styleNode,
org.w3c.dom.Node sourceNode,
int msg)
Deprecated. Warn the user of an problem. |
void |
warn(org.w3c.dom.Node styleNode,
org.w3c.dom.Node sourceNode,
int msg,
java.lang.Object[] args)
Deprecated. Warn the user of an problem. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
protected XSLTEngineImpl() throws org.xml.sax.SAXException
XSLTProcessorFactory
,
XSLTProcessor
public XSLTEngineImpl(java.lang.String liaisonClassName) throws org.xml.sax.SAXException
XSLTProcessorFactory
,
XSLTProcessor
public XSLTEngineImpl(XMLParserLiaison parserLiaison) throws org.xml.sax.SAXException
XMLParserLiaison
- A liaison to an XML parser.XMLParserLiaison
,
XSLTProcessorFactory
,
XSLTProcessor
Method Detail |
public XMLParserLiaison createLiaison() throws org.xml.sax.SAXException
public void reset()
public void process(XSLTInputSource inputSource, XSLTInputSource stylesheetSource, XSLTResultTarget outputTarget) throws org.xml.sax.SAXException
XSLTProcessor.process(weblogic.apache.xalan.xslt.XSLTInputSource, weblogic.apache.xalan.xslt.XSLTInputSource, weblogic.apache.xalan.xslt.XSLTResultTarget)
method.
inputSource
- The input source.stylesheetSource
- The stylesheet source. May be null if source has a xml-stylesheet PI.outputTarget
- The output source tree.public StylesheetRoot createStylesheetRoot(java.lang.String baseIdentifier) throws java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException, org.xml.sax.SAXException
public StylesheetRoot processStylesheet(XSLTInputSource stylesheetSource) throws org.xml.sax.SAXException
xmldocURLString
- The URL to the input XML document.public StylesheetRoot processStylesheet(java.lang.String xsldocURLString) throws org.xml.sax.SAXException
xmldocURLString
- The URL to the input XML document.public void setStylesheet(StylesheetRoot stylesheetRoot)
public StylesheetRoot getStylesheet()
public java.lang.String getOutputFileName()
public void setOutputFileName(java.lang.String filename)
public org.w3c.dom.Node getSourceTreeFromInput(XSLTInputSource inputSource) throws org.xml.sax.SAXException
public static java.net.URL getURLFromString(java.lang.String urlString, java.lang.String base) throws org.xml.sax.SAXException
public void message(java.lang.String msg) throws org.xml.sax.SAXException
public void message(org.w3c.dom.Node styleNode, org.w3c.dom.Node sourceNode, java.lang.String msg) throws org.xml.sax.SAXException
public void warn(int msg) throws org.xml.sax.SAXException
public void warn(int msg, java.lang.Object[] args) throws org.xml.sax.SAXException
public void warn(org.w3c.dom.Node styleNode, org.w3c.dom.Node sourceNode, int msg) throws org.xml.sax.SAXException
public void warn(org.w3c.dom.Node styleNode, org.w3c.dom.Node sourceNode, int msg, java.lang.Object[] args) throws org.xml.sax.SAXException
public void error(java.lang.String msg) throws org.xml.sax.SAXException
public void error(int msg) throws org.xml.sax.SAXException
public void error(int msg, java.lang.Object[] args) throws org.xml.sax.SAXException
public void error(int msg, java.lang.Exception e) throws org.xml.sax.SAXException
public void error(int msg, java.lang.Object[] args, java.lang.Exception e) throws org.xml.sax.SAXException
public void error(org.w3c.dom.Node styleNode, org.w3c.dom.Node sourceNode, int msg) throws org.xml.sax.SAXException
public void error(org.w3c.dom.Node styleNode, org.w3c.dom.Node sourceNode, int msg, java.lang.Object[] args) throws org.xml.sax.SAXException
protected void displayDuration(java.lang.String info, java.lang.Object key)
public void setDiagnosticsOutput(java.io.OutputStream out)
public void setDiagnosticsOutput(java.io.PrintWriter pw)
protected void diag(java.lang.String s)
public void setTraceTemplates(boolean b)
public void setTraceSelect(boolean b)
public void setTraceTemplateChildren(boolean b)
public void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId) throws org.xml.sax.SAXException
Any declarations are assumed to be in the internal subset unless otherwise indicated by a startEntity event.
Note that the start/endDTD events will appear within the start/endDocument events from ContentHandler and before the first startElement event.
name
- The document type name.publicId
- The declared public identifier for the
external DTD subset, or null if none was declared.systemId
- The declared system identifier for the
external DTD subset, or null if none was declared.endDTD()
,
startEntity(java.lang.String)
public void endDTD() throws org.xml.sax.SAXException
startDTD(java.lang.String, java.lang.String, java.lang.String)
public void startEntity(java.lang.String name) throws org.xml.sax.SAXException
public void endEntity(java.lang.String name) throws org.xml.sax.SAXException
name
- The name of the entity that is ending.startEntity(java.lang.String)
public void startCDATA() throws org.xml.sax.SAXException
The contents of the CDATA section will be reported through the regular characters event.
endCDATA()
public void endCDATA() throws org.xml.sax.SAXException
startCDATA()
public void comment(char[] ch, int start, int length) throws org.xml.sax.SAXException
This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read).
ch
- An array holding the characters in the comment.start
- The starting position in the array.length
- The number of characters to use from the array.public void setDocumentLocator(org.xml.sax.Locator locator)
SAX parsers are strongly encouraged (though not absolutely required) to supply a locator: if it does so, it must supply the locator to the application by invoking this method before invoking any of the other methods in the DocumentHandler interface.
The locator allows the application to determine the end position of any document-related event, even if the parser is not reporting an error. Typically, the application will use this information for reporting its own errors (such as character content that does not match an application's business rules). The information returned by the locator is probably not sufficient for use with a search engine.
Note that the locator will return correct information only during the invocation of the events in this interface. The application should not attempt to use it at any other time.
locator
- An object that can return the location of
any SAX document event.Locator
public void startDocument() throws org.xml.sax.SAXException
The SAX parser will invoke this method only once, before any other methods in this interface or in DTDHandler (except for setDocumentLocator).
public void endDocument() throws org.xml.sax.SAXException
The SAX parser will invoke this method only once, and it will be the last method invoked during the parse. The parser shall not invoke this method until it has either abandoned parsing (because of an unrecoverable error) or reached the end of input.
public void startElement(java.lang.String name, org.xml.sax.AttributeList atts) throws org.xml.sax.SAXException
The Parser will invoke this method at the beginning of every element in the XML document; there will be a corresponding endElement() event for every startElement() event (even when the element is empty). All of the element's content will be reported, in order, before the corresponding endElement() event.
If the element name has a namespace prefix, the prefix will still be attached. Note that the attribute list provided will contain only attributes with explicit values (specified or defaulted): #IMPLIED attributes will be omitted.
name
- The element type name.atts
- The attributes attached to the element, if any.endElement(java.lang.String)
,
AttributeList
public void endElement(java.lang.String name) throws org.xml.sax.SAXException
The SAX parser will invoke this method at the end of every element in the XML document; there will be a corresponding startElement() event for every endElement() event (even when the element is empty).
If the element name has a namespace prefix, the prefix will still be attached to the name.
name
- The element type namepublic void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.
The application must not attempt to read from the array outside of the specified range.
Note that some parsers will report whitespace using the ignorableWhitespace() method rather than this one (validating parsers must do so).
ch
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.ignorableWhitespace(char[], int, int)
,
Locator
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
Validating Parsers must use this method to report each chunk of ignorable whitespace (see the W3C XML 1.0 recommendation, section 2.10): non-validating parsers may also use this method if they are capable of parsing and using content models.
SAX parsers may return all contiguous whitespace in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity, so that the Locator provides useful information.
The application must not attempt to read from the array outside of the specified range.
ch
- The characters from the XML document.start
- The start position in the array.length
- The number of characters to read from the array.characters(char[], int, int)
public void processingInstruction(java.lang.String target, java.lang.String data) throws org.xml.sax.SAXException
The Parser will invoke this method once for each processing instruction found: note that processing instructions may occur before or after the main document element.
A SAX parser should never report an XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) using this method.
target
- The processing instruction target.data
- The processing instruction data, or null if
none was supplied.public void setOutputStream(java.io.OutputStream os)
public XString createXString(java.lang.String s)
s
- A valid string.public XObject createXObject(java.lang.Object o)
o
- Any java object.public XNumber createXNumber(double d)
d
- Any double number.public XBoolean createXBoolean(boolean b)
b
- boolean value.public XNodeSet createXNodeSet(org.w3c.dom.NodeList nl)
nl
- A NodeList object.public XNodeSet createXNodeSet(org.w3c.dom.Node n)
n
- A DOM node.public XNull createXNull()
public XMLParserLiaison getXMLProcessorLiaison()
public StylesheetSpec getAssociatedStylesheet(XSLTInputSource source, java.lang.String media, java.lang.String charset) throws org.xml.sax.SAXException
media
- The media attribute to be matched. May be null, in which
case the prefered stylesheet will be used (i.e., alternate = no).title
- The value of the title attribute to match. May be null.charset
- The value of the charset attribute to match. May be null.public java.util.Vector getAssociatedStylesheets(XSLTInputSource source, java.lang.String media, java.lang.String charset) throws org.xml.sax.SAXException
media
- The media attribute to be matched. May be null, in which
case the prefered stylesheet will be used (i.e., alternate = no).title
- The value of the title attribute to match. May be null.charset
- The value of the charset attribute to match. May be null.public void setStylesheetParam(java.lang.String key, XObject value)
key
- The name of the param.value
- An XObject that will be used.public void setStylesheetParam(java.lang.String key, java.lang.String expression)
key
- The name of the param.expression
- An expression that will be evaluated.public void setParameter(java.lang.String key, java.lang.Object value)
key
- The name of the param.expression
- An expression that will be evaluated.public org.xml.sax.DocumentHandler getFormatterListener()
public void setFormatterListener(org.xml.sax.DocumentHandler flistener)
public org.xml.sax.DocumentHandler getDocumentHandler()
public void setDocumentHandler(org.xml.sax.DocumentHandler listener)
public void addTraceListener(TraceListener tl) throws java.util.TooManyListenersException
tl
- Trace listener to be added.public void setQuietConflictWarnings(boolean b)
b
- true if conflict warnings should be suppressed.public void removeTraceListener(TraceListener tl)
tl
- Trace listener to be removed.public void setProblemListener(ProblemListener l)
l
- A ProblemListener interface.public ProblemListener getProblemListener()
public TransformerImpl getTransformer()
public TransformerFactoryImpl getTransformerFactory()
|
Documentation is available at http://download.oracle.com/docs/cd/E13222_01/wls/docs70 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |