You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mm...@apache.org on 2001/06/15 00:27:27 UTC
cvs commit: xml-xalan/java/compat_src/org/apache/xalan/xslt Stylesheet.java StylesheetHandler.java StylesheetRoot.java StylesheetSpec.java XSLProcessorContext.java XSLProcessorException.java XSLTEngineImpl.java XSLTInputSource.java XSLTProcessor.java XSLTProcessorFactory.java XSLTResultTarget.java
mmidy 01/06/14 15:27:27
Modified: java/compat_src/org/apache/xalan/xpath XBoolean.java
XBooleanStatic.java XNodeSet.java XNull.java
XNumber.java XObject.java XPathSupport.java
XPathSupportDefault.java XRTreeFrag.java
XString.java
java/compat_src/org/apache/xalan/xpath/xdom
XercesLiaison.java
java/compat_src/org/apache/xalan/xpath/xml
FormatterToDOM.java FormatterToHTML.java
FormatterToText.java FormatterToXML.java
ProblemListener.java ProblemListenerDefault.java
TreeWalker.java XMLParserLiaison.java
XMLParserLiaisonDefault.java
java/compat_src/org/apache/xalan/xslt Stylesheet.java
StylesheetHandler.java StylesheetRoot.java
StylesheetSpec.java XSLProcessorContext.java
XSLProcessorException.java XSLTEngineImpl.java
XSLTInputSource.java XSLTProcessor.java
XSLTProcessorFactory.java XSLTResultTarget.java
Log:
Deprecate the compatibility package.
Revision Changes Path
1.4 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/XBoolean.java
Index: XBoolean.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XBoolean.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XBoolean.java 2001/06/14 18:26:33 1.3
+++ XBoolean.java 2001/06/14 22:26:55 1.4
@@ -62,6 +62,7 @@
* <meta name="usage" content="advanced"/>
* This class represents an XPath boolean object, and is capable of
* converting the boolean to other types, such as a string.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XBoolean extends XObject
{
1.4 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/XBooleanStatic.java
Index: XBooleanStatic.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XBooleanStatic.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XBooleanStatic.java 2001/06/14 18:26:36 1.3
+++ XBooleanStatic.java 2001/06/14 22:26:55 1.4
@@ -62,6 +62,7 @@
* <meta name="usage" content="internal"/>
* This class doesn't have any XPathSupport, so override
* whatever to ensure it works OK.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XBooleanStatic extends XBoolean
{
1.4 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/XNodeSet.java
Index: XNodeSet.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XNodeSet.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XNodeSet.java 2001/06/14 18:26:38 1.3
+++ XNodeSet.java 2001/06/14 22:26:56 1.4
@@ -74,6 +74,7 @@
* <meta name="usage" content="general"/>
* This class represents an XPath nodeset object, and is capable of
* converting the nodeset to other types, such as a string.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XNodeSet extends XObject
{
1.4 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/XNull.java
Index: XNull.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XNull.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XNull.java 2001/06/14 18:26:40 1.3
+++ XNull.java 2001/06/14 22:26:56 1.4
@@ -65,6 +65,7 @@
* <meta name="usage" content="general"/>
* This class represents an XPath null object, and is capable of
* converting the null to other types, such as a string.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XNull extends XObject
{
1.5 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/XNumber.java
Index: XNumber.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XNumber.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XNumber.java 2001/06/14 18:26:42 1.4
+++ XNumber.java 2001/06/14 22:26:56 1.5
@@ -63,6 +63,7 @@
* <meta name="usage" content="general"/>
* This class represents an XPath number, and is capable of
* converting the number to other types, such as a string.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XNumber extends XObject
{
1.3 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/XObject.java
Index: XObject.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XObject.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XObject.java 2001/06/14 18:26:43 1.2
+++ XObject.java 2001/06/14 22:26:57 1.3
@@ -68,6 +68,7 @@
* converting the object to various types, such as a string.
* This class acts as the base class to other XPath type objects,
* such as XString, and provides polymorphic casting capabilities.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XObject extends Object implements Serializable
{
1.3 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/XPathSupport.java
Index: XPathSupport.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XPathSupport.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XPathSupport.java 2001/06/14 18:26:45 1.2
+++ XPathSupport.java 2001/06/14 22:26:57 1.3
@@ -72,6 +72,7 @@
* parser services, DOM implementation, etc. Most if all implementations
* of this should derive from XPathSupportDefault (hence, it should
* probably be an abstract class instead of an interface).
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public interface XPathSupport
{
1.2 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/XPathSupportDefault.java
Index: XPathSupportDefault.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XPathSupportDefault.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XPathSupportDefault.java 2001/01/23 20:06:42 1.1
+++ XPathSupportDefault.java 2001/06/14 22:26:57 1.2
@@ -67,6 +67,7 @@
* of the functions in this class need to be overridden in order to
* perform correct execution of the XPath (for instance, variable
* execution). This class will likely eventually replace XMLParserLiaisons.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XPathSupportDefault extends org.apache.xpath.XPathContext implements XPathSupport
{
1.4 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/XRTreeFrag.java
Index: XRTreeFrag.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XRTreeFrag.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XRTreeFrag.java 2001/06/14 18:26:47 1.3
+++ XRTreeFrag.java 2001/06/14 22:26:58 1.4
@@ -62,6 +62,7 @@
* <meta name="usage" content="general"/>
* This class represents an XPath result tree fragment object, and is capable of
* converting the RTF to other types, such as a string.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XRTreeFrag extends XObject
{
1.4 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/XString.java
Index: XString.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/XString.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XString.java 2001/06/14 18:26:49 1.3
+++ XString.java 2001/06/14 22:26:58 1.4
@@ -64,6 +64,7 @@
* <meta name="usage" content="general"/>
* This class represents an XPath string object, and is capable of
* converting the string to other types, such as a number.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XString extends XObject
{
1.3 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/xdom/XercesLiaison.java
Index: XercesLiaison.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/xdom/XercesLiaison.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XercesLiaison.java 2001/06/14 18:27:10 1.2
+++ XercesLiaison.java 2001/06/14 22:27:05 1.3
@@ -80,6 +80,7 @@
* the source tree or as the result tree.
* @see org.apache.xalan.xslt.XSLTProcessor
* @see org.apache.xml.parsers
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XercesLiaison extends XMLParserLiaisonDefault //implements XPathSupport
{
1.3 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/FormatterToDOM.java
Index: FormatterToDOM.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/FormatterToDOM.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FormatterToDOM.java 2001/01/12 21:26:08 1.2
+++ FormatterToDOM.java 2001/06/14 22:27:07 1.3
@@ -71,6 +71,7 @@
* This class takes SAX events (in addition to some extra events
* that SAX doesn't handle yet) and adds the result to a document
* or document fragment.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class FormatterToDOM extends ParserAdapter
{
1.3 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/FormatterToHTML.java
Index: FormatterToHTML.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/FormatterToHTML.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FormatterToHTML.java 2001/01/12 21:26:10 1.2
+++ FormatterToHTML.java 2001/06/14 22:27:07 1.3
@@ -72,6 +72,7 @@
* <meta name="usage" content="general"/>
* FormatterToHTML formats SAX-style events into XML.
* Warning: this class will be replaced by the Xerces Serializer classes.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class FormatterToHTML extends ParserAdapter
{
1.3 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/FormatterToText.java
Index: FormatterToText.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/FormatterToText.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FormatterToText.java 2001/01/12 21:26:11 1.2
+++ FormatterToText.java 2001/06/14 22:27:08 1.3
@@ -69,6 +69,7 @@
* This class takes SAX events (in addition to some extra events
* that SAX doesn't handle yet) and produces simple text only.
* Warning: this class will be replaced by the Xerces Serializer classes.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class FormatterToText extends ParserAdapter
{
1.3 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/FormatterToXML.java
Index: FormatterToXML.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/FormatterToXML.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FormatterToXML.java 2001/01/12 21:26:13 1.2
+++ FormatterToXML.java 2001/06/14 22:27:08 1.3
@@ -74,6 +74,7 @@
* <meta name="usage" content="general"/>
* FormatterToXML formats SAX-style events into XML.
* Warning: this class will be replaced by the Xerces Serializer classes.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class FormatterToXML extends ParserAdapter
{
1.2 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/ProblemListener.java
Index: ProblemListener.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/ProblemListener.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ProblemListener.java 2001/01/11 19:29:06 1.1
+++ ProblemListener.java 2001/06/14 22:27:09 1.2
@@ -65,6 +65,7 @@
* Users should ass the XSLTEngineImpl class to setProblemListener
* if they wish an object instance to be called when a problem
* event occurs.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public interface ProblemListener
{
1.6 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/ProblemListenerDefault.java
Index: ProblemListenerDefault.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/ProblemListenerDefault.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ProblemListenerDefault.java 2001/01/26 15:54:13 1.5
+++ ProblemListenerDefault.java 2001/06/14 22:27:09 1.6
@@ -69,6 +69,7 @@
* Users should ass the XSLTEngineImpl class to setProblemListener
* if they wish an object instance to be called when a problem
* event occurs.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class ProblemListenerDefault extends org.apache.xml.utils.DefaultErrorHandler implements ProblemListener
{
1.4 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/TreeWalker.java
Index: TreeWalker.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/TreeWalker.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TreeWalker.java 2001/03/13 16:26:54 1.3
+++ TreeWalker.java 2001/06/14 22:27:09 1.4
@@ -66,6 +66,7 @@
* <meta name="usage" content="advanced"/>
* This class does a pre-order walk of the DOM tree, calling the FormatterListener
* interface as it goes.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class TreeWalker //extends org.apache.xml.utils.TreeWalker
{
1.2 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/XMLParserLiaison.java
Index: XMLParserLiaison.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/XMLParserLiaison.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XMLParserLiaison.java 2001/01/11 19:29:06 1.1
+++ XMLParserLiaison.java 2001/06/14 22:27:10 1.2
@@ -66,6 +66,7 @@
* Users should ass the XSLTEngineImpl class to setProblemListener
* if they wish an object instance to be called when a problem
* event occurs.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XMLParserLiaison extends DOM2Helper
{
1.4 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/XMLParserLiaisonDefault.java
Index: XMLParserLiaisonDefault.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xpath/xml/XMLParserLiaisonDefault.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XMLParserLiaisonDefault.java 2001/06/14 18:27:16 1.3
+++ XMLParserLiaisonDefault.java 2001/06/14 22:27:10 1.4
@@ -70,6 +70,7 @@
/**
* A class that handles interfacing IBM's XML4J2 to the
* Lotus XSL Processor.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XMLParserLiaisonDefault extends XMLParserLiaison
{
1.2 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xslt/Stylesheet.java
Index: Stylesheet.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xslt/Stylesheet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Stylesheet.java 2001/03/27 15:43:29 1.1
+++ Stylesheet.java 2001/06/14 22:27:16 1.2
@@ -69,6 +69,7 @@
* At the moment these stylesheets can not be reused within the
* stylesheet tree or between trees. This needs to be fixed
* in the future.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class Stylesheet extends org.apache.xalan.templates.Stylesheet
{
1.2 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xslt/StylesheetHandler.java
Index: StylesheetHandler.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xslt/StylesheetHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StylesheetHandler.java 2001/01/11 19:29:07 1.1
+++ StylesheetHandler.java 2001/06/14 22:27:16 1.2
@@ -73,6 +73,7 @@
* If you need to alter the code in here,
* it is not for the faint-of-heart, due to the state tracking
* that has to be done due to the SAX event model.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class StylesheetHandler extends ParserAdapter
1.10 +25 -145 xml-xalan/java/compat_src/org/apache/xalan/xslt/StylesheetRoot.java
Index: StylesheetRoot.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xslt/StylesheetRoot.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- StylesheetRoot.java 2001/06/14 18:27:22 1.9
+++ StylesheetRoot.java 2001/06/14 22:27:17 1.10
@@ -80,6 +80,7 @@
* Binary representation of a stylesheet -- use the {@link org.apache.xalan.xslt.XSLTProcessor} ProcessStylesheet
* method to create a StylesheetRoot and improve performance for a stylesheet performing multiple transformations.
* Also required for XSLTProcessor to function as SAX DocumentHandler.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class StylesheetRoot extends Stylesheet
{
@@ -146,9 +147,8 @@
(null != m_liaisonClassUsedToCreate) ?
new XSLTProcessorFactory().getProcessorUsingLiaisonName(m_liaisonClassUsedToCreate)
: new XSLTProcessorFactory().getProcessor();
- process(iprocessor, iprocessor.getSourceTreeFromInput(xmlSource), outputTarget);
- // System.out.println("Number counters made: "+
- // ((XSLTEngineImpl)iprocessor).getCountersTable().m_countersMade);
+ process(iprocessor, xmlSource, outputTarget);
+
}
/**
@@ -168,7 +168,24 @@
FileNotFoundException,
IOException
{
- process(iprocessor, iprocessor.getSourceTreeFromInput(xmlSource), outputTarget);
+ //process(iprocessor, iprocessor.getSourceTreeFromInput(xmlSource), outputTarget);
+ XSLTEngineImpl processor = (XSLTEngineImpl)iprocessor; // TODO: Check for class cast exception
+
+ synchronized(processor)
+ {
+ processor.setStylesheet(this);
+
+ try
+ {
+ processor.getTransformer().transform(xmlSource.getSourceObject(),
+ outputTarget.getResultObject());
+ }
+ catch (TransformerException te)
+ {
+ throw new SAXException(te);
+ }
+ }
+
}
/**
@@ -188,6 +205,7 @@
FileNotFoundException,
IOException
{
+
XSLTEngineImpl processor = (XSLTEngineImpl)iprocessor; // TODO: Check for class cast exception
//checkInit(processor);
synchronized(processor)
@@ -200,147 +218,9 @@
try
{
- // Double-check the node to make sure it matches the processor liaison.
- //processor.getXMLProcessorLiaison().checkNode(sourceTree);
-
- // Needs work: We have to put the extension namespaces
- // into the liaison's table. We wouldn't have to do this
- // if the stylesheet handled it's own extensions, which
- // I'll fix on a later date.
- /* Enumeration keys = m_extensionNamespaces.keys();
- while(keys.hasMoreElements())
- {
- Object key = keys.nextElement();
- // System.out.println("Putting ext namespace: "+key);
- processor.getExecContext().addExtensionNamespace ((String)key,
- (ExtensionFunctionHandler)m_extensionNamespaces.get(key));
- }*/
-
- // Find the root pattern in the XSL.
- int child = processor.getTransformer().getXPathContext().getDTMHandleFromNode(sourceTree);
- ElemTemplate rootRule = m_sRootObject.getTemplateComposed(processor.getTransformer().getXPathContext(),
- child,
- null, -1, false,
- processor.getTransformer().getXPathContext().getDTM(child));
- //this.findTemplate(processor, sourceTree, sourceTree);
-
- if(null == rootRule)
- {
- rootRule = m_sRootObject.getDefaultRootRule();
- }
-
- DocumentHandler docHandler = outputTarget.getDocumentHandler();
-
- OutputFormat formatter = getOutputFormat();
-
- if(null != outputTarget.getEncoding())
- formatter.setEncoding(outputTarget.getEncoding());
-
- if(null != docHandler)
- {
- processor.setDocumentHandler(docHandler);
- }
- else if(null != outputTarget.getByteStream())
- {
- /* if (!(processor.getXMLProcessorLiaison()..getIndent() < 0))
- {
- // This is to get around differences between Xalan and Xerces.
- // Xalan uses -1 as default for no indenting, Xerces uses 0.
- // So we just bump up the indent value here because we will
- // subtract from it at output time (FormatterToXML.init());
- formatter.setIndent(processor.m_parserLiaison.getIndent() + 1);
- }*/
- processor.setDocumentHandler(makeSAXSerializer(outputTarget.getByteStream(),
- formatter));
- }
- else if(null != outputTarget.getCharacterStream())
- {
- /* if (!(processor.m_parserLiaison.getIndent() < 0))
- {
- formatter.setIndent(processor.m_parserLiaison.getIndent() + 1);
- }*/
- processor.setDocumentHandler(makeSAXSerializer(outputTarget.getCharacterStream(),
- formatter));
- }
- else if(null != outputTarget.getFileName())
- {
- /*if (!(processor.m_parserLiaison.getIndent() < 0))
- {
- formatter.setIndent(processor.m_parserLiaison.getIndent() + 1);
- }*/
- ostream = new FileOutputStream(outputTarget.getFileName());
- processor.setDocumentHandler( makeSAXSerializer(ostream, formatter));
- }
- else if(null != outputTarget.getNode())
- {
- ParserAdapter handler = new ParserAdapter(new org.apache.xerces.parsers.SAXParser());
- // Patch from Costin Manolache
-// if( "org.apache.xalan.xpath.dtm.DTMLiaison".equals( processor.getXMLProcessorLiaison().getClass().getName()))
-// processor.error(XSLTErrorResources.ER_CANT_USE_DTM_FOR_OUTPUT); //Can't use a DTMLiaison for an output DOM node... pass a org.apache.xalan.xpath.xdom.XercesLiaison instead!");
-
- switch(outputTarget.getNode().getNodeType())
- {
- case Node.DOCUMENT_NODE:
- handler.setContentHandler(new FormatterToDOM((Document)outputTarget.getNode()).getSerializerObject());
- processor.setDocumentHandler(handler);
- break;
- case Node.DOCUMENT_FRAGMENT_NODE:
- handler.setContentHandler(new FormatterToDOM(outputTarget.getNode().getOwnerDocument(), // PR:DMAN4M6PK5 Submitted by:<bk...@viae.de>
- (DocumentFragment)outputTarget.getNode()).getSerializerObject());
- processor.setDocumentHandler(handler);
- break;
- case Node.ELEMENT_NODE:
- handler.setContentHandler(new FormatterToDOM(outputTarget.getNode().getOwnerDocument(), // PR:DMAN4M6PK5 Submitted by:<bk...@viae.de>
- (Element)outputTarget.getNode()).getSerializerObject());
- processor.setDocumentHandler(handler);
- break;
- default:
- m_sRootObject.error(XSLTErrorResources.ER_CAN_ONLY_OUTPUT_TO_ELEMENT); //"Can only output to an Element, DocumentFragment, Document, or PrintWriter.");
- }
- }
- else
- {
- ParserAdapter handler = new ParserAdapter(new org.apache.xerces.parsers.SAXParser());
- outputTarget.setNode(processor.getXMLProcessorLiaison().createDocument());
- handler.setContentHandler(new FormatterToDOM((Document)outputTarget.getNode()).getSerializerObject());
- processor.setDocumentHandler(handler);
- }
-
- // processor.resetCurrentState(sourceTree);
- // processor.m_rootDoc = sourceTree;
-
- if(null != processor.m_diagnosticsPrintWriter)
- {
- processor.diag("=============================");
- processor.diag("Transforming...");
- processor.pushTime(sourceTree);
- }
-
- // processor.getVarStack().pushContextMarker();
- // try
- // {
- // processor.resolveTopLevelParams();
- // }
- // catch(Exception e)
- // {
- // throw new SAXException(XSLMessages.createMessage(XSLTErrorResources.ER_PROCESS_ERROR, null), e); //"StylesheetRoot.process error", e);
- // }
-
- processor.getTransformer().getResultTreeHandler().startDocument();
-
- // Output the action of the found root rule. All processing
- // occurs from here. buildResultFromTemplate is highly recursive.
- rootRule.execute(processor.getTransformer());
-
- processor.getTransformer().getResultTreeHandler().endDocument();
-
- // Reset the top-level params for the next round.
- // processor.m_topLevelParams = new Vector();
-
- if(null != processor.m_diagnosticsPrintWriter)
- {
- processor.displayDuration("transform", sourceTree);
- }
+ processor.getTransformer().transform(new javax.xml.transform.dom.DOMSource(sourceTree),
+ outputTarget.getResultObject());
+
}
catch (TransformerException te)
{
1.2 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xslt/StylesheetSpec.java
Index: StylesheetSpec.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xslt/StylesheetSpec.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StylesheetSpec.java 2001/01/11 19:29:08 1.1
+++ StylesheetSpec.java 2001/06/14 22:27:18 1.2
@@ -62,6 +62,7 @@
* <meta name="usage" content="general"/>
* This class implements the representation of a stylesheet
* specification via xml-stylesheet in an XML document.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class StylesheetSpec extends StreamSource
{
1.3 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xslt/XSLProcessorContext.java
Index: XSLProcessorContext.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xslt/XSLProcessorContext.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSLProcessorContext.java 2001/06/14 18:27:25 1.2
+++ XSLProcessorContext.java 2001/06/14 22:27:18 1.3
@@ -69,6 +69,7 @@
* passed to an extension element.
*
* @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XSLProcessorContext extends org.apache.xalan.extensions.XSLProcessorContext
{
1.2 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xslt/XSLProcessorException.java
Index: XSLProcessorException.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xslt/XSLProcessorException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XSLProcessorException.java 2001/03/28 16:22:35 1.1
+++ XSLProcessorException.java 2001/06/14 22:27:18 1.2
@@ -64,6 +64,7 @@
/**
* <meta name="usage" content="general"/>
* The exception used for most XSLT errors.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XSLProcessorException extends SAXException
{
1.27 +27 -32 xml-xalan/java/compat_src/org/apache/xalan/xslt/XSLTEngineImpl.java
Index: XSLTEngineImpl.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xslt/XSLTEngineImpl.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- XSLTEngineImpl.java 2001/06/14 18:27:27 1.26
+++ XSLTEngineImpl.java 2001/06/14 22:27:19 1.27
@@ -114,7 +114,12 @@
import org.apache.xml.utils.DefaultErrorHandler;
import org.apache.xalan.transformer.TransformerHandlerImpl;
+// Imported JAVA API for XML Parsing 1.0 classes
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
/**
* <meta name="usage" content="advanced"/>
* The Xalan workhorse -- Collaborates with the XML parser liaison, the DOM,
@@ -140,6 +145,7 @@
* <p>If you reuse the processor instance, you should call reset() between transformations.</p>
* @see XSLTProcessorFactory
* @see XSLTProcessor
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XSLTEngineImpl implements XSLTProcessor
{
@@ -768,38 +774,27 @@
displayDuration("Parse of "+xmlIdentifier, xmlIdentifier);
sourceTree = m_liaison.getDocument();
}
- else
- {
- XMLReader reader = XMLReaderFactory.createXMLReader();
- try
- {
- reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
- }
- catch(SAXException se)
- {
- // What can we do?
- // TODO: User diagnostics.
- }
-
- // Get the input content handler, which will handle the
- // parse events and create the source tree.
- //StylesheetHandler inputHandler = (StylesheetHandler)m_processor.getTemplatesBuilder();
- //reader.setContentHandler( inputHandler );
-
- /*TransformerHandlerImpl handler = new TransformerHandlerImpl(getTransformer(), false,
- xmlIdentifier);
- reader.setContentHandler(handler);
- reader.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
- */
- // Kick off the parse. When the ContentHandler gets
- // the startDocument event, it will call transformNode( node ).
- /* reader.parse( SAXSource.sourceToInputSource(iSource));
- sourceTree = handler.getRoot();
- */
- org.apache.xml.dtm.DTMManager dtmManager = new org.apache.xml.dtm.ref.DTMManagerDefault();
- org.apache.xml.dtm.DTM dtm = dtmManager.getDTM(inputSource.getSourceObject(), true, null, false, false);
- sourceTree = dtm.getNode(dtm.getDocument());
- }
+ else
+ {
+ try
+ {
+
+ // Use an implementation of the JAVA API for XML Parsing 1.0 to
+ // create a DOM Document node to contain the result.
+ DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
+
+ dfactory.setNamespaceAware(true);
+ dfactory.setValidating(true);
+
+ DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
+ sourceTree = docBuilder.parse(xmlIdentifier);
+
+ }
+ catch (ParserConfigurationException pce)
+ {
+ error(XSLTErrorResources.ER_COULDNT_PARSE_DOC, new Object[] {xmlIdentifier}, pce);
+ }
+ }
}
catch(Exception e)
{
1.6 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xslt/XSLTInputSource.java
Index: XSLTInputSource.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xslt/XSLTInputSource.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XSLTInputSource.java 2001/02/14 16:54:54 1.5
+++ XSLTInputSource.java 2001/06/14 22:27:20 1.6
@@ -74,6 +74,7 @@
* DOM nodes as input as well as files, character streams, byte streams and SAX DocumentHandlers.
*
* @see XSLTProcessor#process(XSLTInputSource, XSLTInputSource, XSLTResultTarget)
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XSLTInputSource //extends SAXSource
{
1.4 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xslt/XSLTProcessor.java
Index: XSLTProcessor.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xslt/XSLTProcessor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSLTProcessor.java 2001/01/19 18:48:52 1.3
+++ XSLTProcessor.java 2001/06/14 22:27:20 1.4
@@ -97,6 +97,7 @@
* for an advanced usage example.
*
* <p>If you reuse the processor instance, you should call reset() between transformations.</p>
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public interface XSLTProcessor extends DocumentHandler, LexicalHandler
{
1.3 +1 -0 xml-xalan/java/compat_src/org/apache/xalan/xslt/XSLTProcessorFactory.java
Index: XSLTProcessorFactory.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xslt/XSLTProcessorFactory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSLTProcessorFactory.java 2001/01/19 18:48:53 1.2
+++ XSLTProcessorFactory.java 2001/06/14 22:27:20 1.3
@@ -67,6 +67,7 @@
* <meta name="usage" content="general"/>
* Manufactures the processor for performing transformations. Use one of the static getProcessor methods
* to create an XSLTProcessor object.
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XSLTProcessorFactory
{
1.5 +4 -1 xml-xalan/java/compat_src/org/apache/xalan/xslt/XSLTResultTarget.java
Index: XSLTResultTarget.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/compat_src/org/apache/xalan/xslt/XSLTResultTarget.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XSLTResultTarget.java 2001/02/02 19:10:31 1.4
+++ XSLTResultTarget.java 2001/06/14 22:27:21 1.5
@@ -79,6 +79,7 @@
*
* @see XSLTProcessor#process(XSLTInputSource, XSLTInputSource, XSLTResultTarget)
* @see StylesheetRoot
+ * @deprecated This compatibility layer will be removed in later releases.
*/
public class XSLTResultTarget //implements Result //extends StreamResult
{
@@ -199,7 +200,7 @@
*/
public XSLTResultTarget(DocumentHandler handler)
{
- SAXResult saxResult = new SAXResult();
+ saxResult = new SAXResult();
setDocumentHandler(handler);
}
@@ -275,6 +276,8 @@
public void setDocumentHandler (DocumentHandler handler)
{
this.formatterListener = handler;
+ if (handler instanceof XSLTEngineImpl)
+ saxResult.setHandler(((XSLTEngineImpl)handler).getTransformer().getContentHandler());
if (handler instanceof ParserAdapter)
{
if (saxResult == null)
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org