mmidy 01/06/14 11:27:52
Modified: java/compat_src/org/apache/xalan/xpath XBoolean.java
XBooleanStatic.java XNodeSet.java XNull.java
XNumber.java XObject.java XPathSupport.java
XRTreeFrag.java XString.java
java/compat_src/org/apache/xalan/xpath/xdom
XercesLiaison.java
java/compat_src/org/apache/xalan/xpath/xml
XMLParserLiaisonDefault.java
java/compat_src/org/apache/xalan/xslt StylesheetRoot.java
XSLProcessorContext.java XSLTEngineImpl.java
Log:
Update compatibility files so that they run with new DTM changes
Revision Changes Path
1.3 +1 -1
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XBoolean.java 2001/01/23 20:04:57 1.2
+++ XBoolean.java 2001/06/14 18:26:33 1.3
@@ -130,7 +130,7 @@
* Tell if two objects are functionally equal.
*/
public boolean equals(XObject obj2)
- throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ throws org.xml.sax.SAXException
{
return m_xboolean.equals(obj2);
}
1.3 +1 -1
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XBooleanStatic.java 2001/01/23 20:05:00 1.2
+++ XBooleanStatic.java 2001/06/14 18:26:36 1.3
@@ -80,7 +80,7 @@
* Tell if two objects are functionally equal.
*/
public boolean equals(XObject obj2)
- throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ throws org.xml.sax.SAXException
{
return m_xboolean.equals(obj2);
}
1.3 +59 -76
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XNodeSet.java 2001/01/23 20:05:02 1.2
+++ XNodeSet.java 2001/06/14 18:26:38 1.3
@@ -57,12 +57,18 @@
package org.apache.xalan.xpath;
import org.w3c.dom.*;
+import org.w3c.dom.Text;
import org.w3c.dom.traversal.NodeIterator;
import org.w3c.dom.traversal.NodeFilter;
import java.text.*;
import org.apache.xpath.XPathContext;
import org.apache.xpath.NodeSet;
+import org.apache.xpath.DOMHelper;
+import org.apache.xml.dtm.ref.DTMNodeIterator;
+import org.apache.xml.dtm.ref.DTMNodeList;
+import org.apache.xml.dtm.ref.DTMManagerDefault;
+import org.apache.xml.dtm.DTM;
/**
* <meta name="usage" content="general"/>
@@ -72,6 +78,7 @@
public class XNodeSet extends XObject
{
org.apache.xpath.objects.XNodeSet m_xnodeset;
+ DTMManagerDefault dtmMgr = new DTMManagerDefault();
/**
* Construct a XNodeSet object.
@@ -79,7 +86,8 @@
public XNodeSet(NodeList val)
{
super();
- m_xnodeset = new org.apache.xpath.objects.XNodeSet(new
NodeIteratorWrapper(val)) ;
+ int node = dtmMgr.getDTMHandleFromNode(val.item(0));
+ m_xnodeset = new
org.apache.xpath.objects.XNodeSet(dtmMgr.createDTMIterator(node)) ;
}
/**
@@ -88,7 +96,7 @@
public XNodeSet()
{
super();
- m_xnodeset = new org.apache.xpath.objects.XNodeSet();
+ m_xnodeset = new org.apache.xpath.objects.XNodeSet(dtmMgr);
}
/**
@@ -96,8 +104,8 @@
*/
public XNodeSet(Node n)
{
- super(n);
- m_xnodeset = new org.apache.xpath.objects.XNodeSet(n);
+ super(n);
+ m_xnodeset = new
org.apache.xpath.objects.XNodeSet(dtmMgr.getDTMHandleFromNode(n), dtmMgr);
}
@@ -123,7 +131,7 @@
*/
double getNumberFromNode(Node n)
{
- return m_xnodeset.getNumberFromNode(n);
+ return m_xnodeset.getNumberFromNode(dtmMgr.getDTMHandleFromNode(n));
}
/**
@@ -148,8 +156,23 @@
*/
static String getStringFromNode(Node n)
{
- return org.apache.xpath.objects.XNodeSet.getStringFromNode(n);
+ switch (n.getNodeType())
+ {
+ case Node.ELEMENT_NODE :
+ case Node.DOCUMENT_NODE :
+ return DOMHelper.getNodeData(n);
+ case Node.CDATA_SECTION_NODE :
+ case Node.TEXT_NODE :
+ return ((Text) n).getData();
+ case Node.COMMENT_NODE :
+ case Node.PROCESSING_INSTRUCTION_NODE :
+ case Node.ATTRIBUTE_NODE :
+ return n.getNodeValue();
+ default :
+ return DOMHelper.getNodeData(n);
+ }
}
+
/**
* Cast result object to a string.
@@ -164,7 +187,7 @@
*/
public DocumentFragment rtree(XPathSupport support)
{
- return m_xnodeset.rtree((XPathContext) support);
+ return rtree((XPathContext) support);
}
/**
@@ -176,23 +199,25 @@
*/
public DocumentFragment rtree(XPathContext support)
{
- return m_xnodeset.rtree(support);
+ org.apache.xpath.XPathContext context =
(org.apache.xpath.XPathContext)support;
+ int result = m_xnodeset.rtree(context);
+ return
(DocumentFragment)context.getDTMManager().getDTM(result).getNode(result);
}
/**
* Cast result object to a nodelist.
*/
- public NodeIterator nodeset()
+ public NodeList nodeset()
{
- return m_xnodeset.nodeset();
+ return new DTMNodeList(m_xnodeset.nodeset());
}
/**
* Cast result object to a nodelist.
*/
- public NodeSet mutableNodeset()
+ public NodeList mutableNodeset()
{
- return m_xnodeset.mutableNodeset();
+ return new DTMNodeList(m_xnodeset.mutableNodeset());
}
/**
@@ -201,7 +226,7 @@
public boolean lessThan(XObject obj2)
throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
{
- return m_xnodeset.lessThan(obj2);
+ return m_xnodeset.lessThan(obj2.m_xObject);
}
/**
@@ -210,7 +235,7 @@
public boolean lessThanOrEqual(XObject obj2)
throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
{
- return m_xnodeset.lessThanOrEqual(obj2);
+ return m_xnodeset.lessThanOrEqual(obj2.m_xObject);
}
/**
@@ -219,7 +244,7 @@
public boolean greaterThan(XObject obj2)
throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
{
- return m_xnodeset.greaterThan(obj2);
+ return m_xnodeset.greaterThan(obj2.m_xObject);
}
/**
@@ -228,14 +253,14 @@
public boolean greaterThanOrEqual(XObject obj2)
throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
{
- return m_xnodeset.greaterThanOrEqual(obj2);
+ return m_xnodeset.greaterThanOrEqual(obj2.m_xObject);
}
/**
* Tell if two objects are functionally equal.
*/
public boolean equals(XObject obj2)
- throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ throws org.xml.sax.SAXException
{
return m_xnodeset.equals(obj2);
}
@@ -246,10 +271,10 @@
public boolean notEquals(XObject obj2)
throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
{
- return m_xnodeset.notEquals(obj2);
+ return m_xnodeset.notEquals(obj2.m_xObject);
}
- static class NodeIteratorWrapper implements NodeIterator
+ static class NodeIteratorWrapper extends org.apache.xpath.NodeSet
{
/** Position of next node */
@@ -257,6 +282,7 @@
/** Document fragment instance this will wrap */
private NodeList m_list;
+ private org.apache.xml.dtm.DTMManager dtmManager;
/**
* Constructor NodeIteratorWrapper
@@ -266,60 +292,12 @@
*/
NodeIteratorWrapper(NodeList list)
{
+ super();
m_list = list;
+ dtmManager = new org.apache.xml.dtm.ref.DTMManagerDefault();
}
- /**
- * The root node of the Iterator, as specified when it was created.
- *
- * @return null
- */
- public Node getRoot()
- {
- return null;
- }
-
- /**
- * This attribute determines which node types are presented via the
- * iterator. The available set of constants is defined in the
- * <code>NodeFilter</code> interface.
- *
- * @return All node types
- */
- public int getWhatToShow()
- {
- return NodeFilter.SHOW_ALL;
- }
-
- /**
- * The filter used to screen nodes.
- *
- * @return null
- */
- public NodeFilter getFilter()
- {
- return null;
- }
-
- /**
- * The value of this flag determines whether the children of entity
- * reference nodes are visible to the iterator. If false, they will be
- * skipped over.
- * <br> To produce a view of the document that has entity references
- * expanded and does not expose the entity reference node itself, use the
- * whatToShow flags to hide the entity reference node and set
- * expandEntityReferences to true when creating the iterator. To produce
- * a view of the document that has entity reference nodes but no entity
- * expansion, use the whatToShow flags to show the entity reference node
- * and set expandEntityReferences to false.
- *
- * @return true
- */
- public boolean getExpandEntityReferences()
- {
- return true;
- }
-
+
/**
* Returns the next node in the set and advances the position of the
* iterator in the set. After a NodeIterator is created, the first call
@@ -330,15 +308,18 @@
* INVALID_STATE_ERR: Raised if this method is called after the
* <code>detach</code> method was invoked.
*/
- public Node nextNode() throws DOMException
+ public int nextNode() throws DOMException
{
+ Node n;
if (m_pos < m_list.getLength())
{
- return m_list.item(m_pos++);
+ n = m_list.item(m_pos++);
+ return dtmManager.getDTMHandleFromNode(n);
}
+
else
- return null;
+ return DTM.NULL;
}
/**
@@ -350,15 +331,17 @@
* INVALID_STATE_ERR: Raised if this method is called after the
* <code>detach</code> method was invoked.
*/
- public Node previousNode() throws DOMException
+ public int previousNode() throws DOMException
{
+ Node n;
if (m_pos >0)
{
- return m_list.item(m_pos-1);
+ n = m_list.item(m_pos-1);
+ return dtmManager.getDTMHandleFromNode(n);
}
else
- return null;
+ return DTM.NULL;
}
/**
1.3 +6 -5
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XNull.java 2001/01/23 20:05:04 1.2
+++ XNull.java 2001/06/14 18:26:40 1.3
@@ -122,7 +122,7 @@
*/
public DocumentFragment rtree(XPathSupport support)
{
- return m_xnull.rtree((XPathContext)support);
+ return rtree((XPathContext)support);
}
/**
@@ -134,14 +134,15 @@
*/
public DocumentFragment rtree(XPathContext support)
{
- return m_xnull.rtree(support);
- }
-
+ org.apache.xpath.XPathContext context =
(org.apache.xpath.XPathContext)support;
+ int result = m_xnull.rtree(context);
+ return
(DocumentFragment)context.getDTMManager().getDTM(result).getNode(result);
+ }
/**
* Cast result object to a nodelist.
*/
- public NodeIterator nodeset()
+ public NodeList nodeset()
{
return null;
}
1.4 +1 -1
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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XNumber.java 2001/03/20 23:19:01 1.3
+++ XNumber.java 2001/06/14 18:26:42 1.4
@@ -131,7 +131,7 @@
* Tell if two objects are functionally equal.
*/
public boolean equals(XObject obj2)
- throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ throws org.xml.sax.SAXException
{
return m_xnumber.equals(obj2);
}
1.2 +191 -5
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XObject.java 2001/01/11 19:29:03 1.1
+++ XObject.java 2001/06/14 18:26:43 1.2
@@ -56,7 +56,12 @@
*/
package org.apache.xalan.xpath;
+import org.w3c.dom.*;
+import java.io.Serializable;
+import org.apache.xpath.res.XPATHErrorResources;
+import org.apache.xalan.res.XSLMessages;
+
/**
* <meta name="usage" content="general"/>
* This class represents an XPath object, and is capable of
@@ -64,24 +69,205 @@
* This class acts as the base class to other XPath type objects,
* such as XString, and provides polymorphic casting capabilities.
*/
-public class XObject extends org.apache.xpath.objects.XObject
+public class XObject extends Object implements Serializable
{
-
+ org.apache.xpath.objects.XObject m_xObject;
/**
* Create an XObject.
*/
public XObject()
{
- super();
+ m_xObject = new org.apache.xpath.objects.XObject() ;
}
/**
* Create an XObject.
*/
public XObject(Object obj)
+ {
+ m_xObject = new org.apache.xpath.objects.XObject(obj) ;
+ }
+
+ /**
+ * Tell what kind of class this is.
+ */
+ public int getType()
+ {
+ return m_xObject.getType();
+ }
+
+ /**
+ * Given a request type, return the equivalent string.
+ * For diagnostic purposes.
+ */
+ protected String getTypeString() // PR:DMAN4MBJ4D Submitted by:<[EMAIL
PROTECTED]> change to protected
+ {
+ return "#UNKNOWN";
+ }
+
+ /**
+ * Cast result object to a number.
+ */
+ public double num()
+ throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ {
+ return m_xObject.num();
+ }
+
+ /**
+ * Cast result object to a boolean.
+ */
+ public boolean bool()
+ throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ {
+ return m_xObject.bool();
+ }
+
+ /**
+ * Cast result object to a string.
+ */
+ public String str()
+ {
+ return m_xObject.str();
+ }
+
+ public String toString()
+ {
+ return m_xObject.toString();
+ }
+
+ /**
+ * Cast result object to a result tree fragment.
+ */
+ public DocumentFragment rtree(XPathSupport support)
+ {
+ org.apache.xpath.XPathContext context =
(org.apache.xpath.XPathContext)support;
+ int result = m_xObject.rtree(context);
+ return
(DocumentFragment)context.getDTMManager().getDTM(result).getNode(result);
+ }
+
+ /**
+ * For functions to override.
+ */
+ public DocumentFragment rtree()
+ {
+ return null;
+ }
+
+ /**
+ * Return a java object that's closes to the represenation
+ * that should be handed to an extension.
+ */
+ public Object object()
+ {
+ return m_xObject.object();
+ }
+
+ /**
+ * Cast result object to a nodelist.
+ */
+ public NodeList nodeset()
+ throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ {
+ error(XPATHErrorResources.ER_CANT_CONVERT_TO_NODELIST, new Object[]
{getTypeString()}); //"Can not convert "+getTypeString()+" to a NodeList!");
+ return null;
+ }
+
+ /**
+ * Cast result object to a nodelist.
+ */
+ public NodeList mutableNodeset()
+ throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ {
+ return new
org.apache.xml.dtm.ref.DTMNodeList(m_xObject.mutableNodeset());
+ }
+
+ /**
+ * Cast object to type t.
+ */
+ public Object castToType(int t, XPathSupport support)
+ throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ {
+ return m_xObject.castToType(t, (org.apache.xpath.XPathContext) support);
+ }
+
+ /**
+ * Tell if one object is less than the other.
+ */
+ public boolean lessThan(XObject obj2)
+ throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ {
+
+ return m_xObject.lessThan(obj2.m_xObject);
+ }
+
+ /**
+ * Tell if one object is less than or equal to the other.
+ */
+ public boolean lessThanOrEqual(XObject obj2)
+ throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ {
+ return m_xObject.lessThanOrEqual(obj2.m_xObject);
+ }
+
+ /**
+ * Tell if one object is less than the other.
+ */
+ public boolean greaterThan(XObject obj2)
+ throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ {
+ return m_xObject.greaterThan(obj2.m_xObject);
+ }
+
+ /**
+ * Tell if one object is less than the other.
+ */
+ public boolean greaterThanOrEqual(XObject obj2)
+ throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ {
+ return m_xObject.greaterThanOrEqual(obj2.m_xObject);
+ }
+
+ /**
+ * Tell if two objects are functionally equal.
+ */
+ public boolean equals(XObject obj2)
+ throws org.xml.sax.SAXException
+ {
+ return m_xObject.equals(obj2.m_xObject);
+ }
+
+ /**
+ * Tell if two objects are functionally not equal.
+ */
+ public boolean notEquals(XObject obj2)
+ throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ {
+ return m_xObject.notEquals(obj2.m_xObject);
+ }
+
+ /**
+ * Tell the user of an error, and probably throw an
+ * exception.
+ */
+ protected void error(int msg)
+ throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
{
- super(obj);
- }
+ error (msg, null);
+ }
+
+ /**
+ * Tell the user of an error, and probably throw an
+ * exception.
+ */
+ protected void error(int msg, Object[] args)
+ throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ {
+ String fmsg = XSLMessages.createXPATHMessage(msg, args);
+
+
+ throw new org.xml.sax.SAXException(fmsg);
+ }
}
1.2 +1 -1
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XPathSupport.java 2001/01/23 20:06:41 1.1
+++ XPathSupport.java 2001/06/14 18:26:45 1.2
@@ -73,7 +73,7 @@
* of this should derive from XPathSupportDefault (hence, it should
* probably be an abstract class instead of an interface).
*/
-public interface XPathSupport extends
org.apache.xalan.extensions.ExpressionContext
+public interface XPathSupport
{
}
1.3 +10 -7
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XRTreeFrag.java 2001/01/23 20:05:08 1.2
+++ XRTreeFrag.java 2001/06/14 18:26:47 1.3
@@ -67,14 +67,16 @@
{
org.apache.xpath.objects.XRTreeFrag m_xrtreefrag;
+ org.apache.xpath.XPathContext context = new
org.apache.xpath.XPathContext();
+
/**
* Create an XObject.
*/
public XRTreeFrag(DocumentFragment frag)
{
- super(frag);
- m_xrtreefrag = new org.apache.xpath.objects.XRTreeFrag(frag);
+ super(frag);
+ m_xrtreefrag = new
org.apache.xpath.objects.XRTreeFrag(context.getDTMHandleFromNode(frag),
context);
}
/**
@@ -97,7 +99,7 @@
/**
* Cast result object to a number.
*/
- public double num()
+ public double num() throws javax.xml.transform.TransformerException
{
return m_xrtreefrag.num();
}
@@ -123,22 +125,23 @@
*/
public DocumentFragment rtree()
{
- return m_xrtreefrag.rtree();
- }
+ int result = m_xrtreefrag.rtree(context);
+ return
(DocumentFragment)context.getDTMManager().getDTM(result).getNode(result);
+ }
/**
* Cast result object to a nodelist. (special function).
*/
public NodeList convertToNodeset()
{
- return m_xrtreefrag.convertToNodeset();
+ return ((DocumentFragment)this.object()).getChildNodes();
}
/**
* Tell if two objects are functionally equal.
*/
public boolean equals(XObject obj2)
- throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ throws org.xml.sax.SAXException
{
return m_xrtreefrag.equals(obj2);
}
1.3 +57 -7
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XString.java 2001/01/23 20:05:09 1.2
+++ XString.java 2001/06/14 18:26:49 1.3
@@ -101,7 +101,52 @@
*/
public static double castToNum(String s)
{
- return org.apache.xpath.objects.XString.castToNum(s);
+ double result;
+
+ if (null == s)
+ result = 0.0;
+ else
+ {
+ try
+ {
+
+ /**
+ * TODO: Adjust this for locale. Need to take into
+ * account the lang parameter on the xsl:sort
+ */
+
+ // It seems we can not use this as it just parses the
+ // start of the string until it finds a non-number char,
+ // which is not what we want according to the XSLT spec.
+ // Also, I *think* this is a local-specific
+ // parse, which is also not what we want according to the
+ // XSLT spec (see below).
+ // NumberFormat formatter = NumberFormat.getNumberInstance();
+ // result = formatter.parse(s.trim()).doubleValue();
+ // The dumb XSLT spec says: "The number function should
+ // not be used for conversion of numeric data occurring
+ // in an element in an XML document unless the element
+ // is of a type that represents numeric data in a
+ // language-neutral format (which would typically be
+ // transformed into a language-specific format for
+ // presentation to a user). In addition, the number
+ // function cannot be used unless the language-neutral
+ // format used by the element is consistent with the
+ // XPath syntax for a Number."
+ // So I guess we need to check, if the default local
+ // is french, does Double.valueOf use the local specific
+ // parse? Or does it use the ieee parse?
+ result = Double.valueOf(s.trim()).doubleValue();
+ }
+
+ // catch (ParseException e)
+ catch (NumberFormatException nfe)
+ {
+ result = Double.NaN;
+ }
+ }
+
+ return result;
}
/**
@@ -132,8 +177,10 @@
* Cast result object to a result tree fragment.
*/
public DocumentFragment rtree(XPathSupport support)
- {
- return m_xstring.rtree((XPathContext)support);
+ {
+ org.apache.xpath.XPathContext context =
(org.apache.xpath.XPathContext)support;
+ int result = m_xstring.rtree(context);
+ return
(DocumentFragment)context.getDTMManager().getDTM(result).getNode(result);
}
@@ -145,15 +192,18 @@
* @return A document fragment with this string as a child node
*/
public DocumentFragment rtree(XPathContext support)
- {
- return m_xstring.rtree(support);
- }
+ {
+ org.apache.xpath.XPathContext context =
(org.apache.xpath.XPathContext)support;
+ int result = m_xstring.rtree(context);
+ return
(DocumentFragment)context.getDTMManager().getDTM(result).getNode(result);
+ }
+
/**
* Tell if two objects are functionally equal.
*/
public boolean equals(XObject obj2)
- throws org.xml.sax.SAXException, javax.xml.transform.TransformerException
+ throws org.xml.sax.SAXException
{
return m_xstring.equals(obj2);
}
1.2 +1 -1
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XercesLiaison.java 2001/03/21 23:15:34 1.1
+++ XercesLiaison.java 2001/06/14 18:27:10 1.2
@@ -287,7 +287,7 @@
* output document. Implementation of XMLParserLiaison
* interface method.
*/
- public Document createDocument()
+ static public Document createDocument()
{
org.apache.xerces.dom.DocumentImpl doc = new
org.apache.xerces.dom.DocumentImpl();
return doc;
1.3 +0 -1
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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLParserLiaisonDefault.java 2001/03/07 18:20:43 1.2
+++ XMLParserLiaisonDefault.java 2001/06/14 18:27:16 1.3
@@ -63,7 +63,6 @@
import org.xml.sax.*;
import org.w3c.dom.*;
-import org.apache.xalan.xpath.xml.*;
import org.apache.xalan.xpath.*;
import org.apache.xpath.*;
import org.apache.xalan.xpath.xml.XMLParserLiaison;
1.9 +10 -5
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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- StylesheetRoot.java 2001/03/27 15:43:29 1.8
+++ StylesheetRoot.java 2001/06/14 18:27:22 1.9
@@ -217,7 +217,11 @@
}*/
// Find the root pattern in the XSL.
- ElemTemplate rootRule =
m_sRootObject.getTemplateComposed(processor.getTransformer().getXPathContext(),
sourceTree, null, -1, false);
+ 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)
@@ -326,7 +330,7 @@
// Output the action of the found root rule. All processing
// occurs from here. buildResultFromTemplate is highly recursive.
- rootRule.execute(processor.getTransformer(), sourceTree, null);
+ rootRule.execute(processor.getTransformer());
processor.getTransformer().getResultTreeHandler().endDocument();
@@ -338,10 +342,11 @@
processor.displayDuration("transform", sourceTree);
}
}
- catch(TransformerException te)
+ catch (TransformerException te)
{
- throw new SAXException(te);
- }
+ throw new SAXException(te);
+ }
+
finally
{
if (null != ostream)
1.2 +1 -2
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XSLProcessorContext.java 2001/01/11 19:29:08 1.1
+++ XSLProcessorContext.java 2001/06/14 18:27:25 1.2
@@ -78,8 +78,7 @@
{
super((TransformerImpl)(processor.getTransformer()),
- stylesheetTree,
- sourceTree, sourceNode, mode);
+ stylesheetTree);
}
1.26 +17 -12
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.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- XSLTEngineImpl.java 2001/03/21 23:15:36 1.25
+++ XSLTEngineImpl.java 2001/06/14 18:27:27 1.26
@@ -112,7 +112,7 @@
import org.apache.xml.utils.TreeWalker;
import org.apache.xml.utils.QName;
import org.apache.xml.utils.DefaultErrorHandler;
-import org.apache.xalan.stree.SourceTreeHandler;
+import org.apache.xalan.transformer.TransformerHandlerImpl;
/**
@@ -471,8 +471,8 @@
m_transformerImpl = (TransformerImpl)templates.newTransformer();
if (m_problemListener != null)
m_transformerImpl.setErrorListener(m_problemListener);
- if (m_liaison != null)
- m_transformerImpl.getXPathContext().setDOMHelper(m_liaison);
+ // if (m_liaison != null)
+ // m_transformerImpl.getXPathContext().setDOMHelper(m_liaison);
}
catch (TransformerConfigurationException tce)
@@ -786,14 +786,19 @@
//StylesheetHandler inputHandler =
(StylesheetHandler)m_processor.getTemplatesBuilder();
//reader.setContentHandler( inputHandler );
- SourceTreeHandler handler = new SourceTreeHandler();
+ /*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));
+ /* 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());
}
}
catch(Exception e)
@@ -857,7 +862,7 @@
parser.initXPath(compiler, "id("+fragID+")", nsNode);
org.apache.xpath.objects.XObject xobj = xpath.execute(xpathContext,
fragBase, nsNode);
- nl = xobj.nodeset();
+ nl = new org.apache.xml.dtm.ref.DTMNodeIterator(xobj.nodeset());
if(nl.nextNode() == null)
{
// xobj = Stylesheet.evalXPathStr(getExecContext(), "//[EMAIL
PROTECTED]'"+fragID+"']", fragBase, nsNode);
@@ -868,7 +873,7 @@
parser.initXPath(compiler, "//[EMAIL PROTECTED]'"+fragID+"']",
nsNode);
xobj = xpath.execute(xpathContext, fragBase, nsNode);
- nl = xobj.nodeset();
+ nl = new org.apache.xml.dtm.ref.DTMNodeIterator(xobj.nodeset());
if(nl.nextNode() == null)
{
// xobj = Stylesheet.evalXPathStr(getExecContext(), "//[EMAIL
PROTECTED]'"+fragID+"']", fragBase, nsNode);
@@ -878,7 +883,7 @@
// Parse the xpath
parser.initXPath(compiler, "//[EMAIL PROTECTED]'"+fragID+"']",
nsNode);
xobj = xpath.execute(xpathContext, fragBase, nsNode);
- nl = xobj.nodeset();
+ nl = new org.apache.xml.dtm.ref.DTMNodeIterator(xobj.nodeset());
if(nl.nextNode() == null)
{
// Well, hell, maybe it's an XPath...
@@ -890,7 +895,7 @@
// Parse the xpath
parser.initXPath(compiler, fragID, nsNode);
xobj = xpath.execute(xpathContext, fragBase, nsNode);
- nl = xobj.nodeset();
+ nl = new org.apache.xml.dtm.ref.DTMNodeIterator(xobj.nodeset());
}
}
}
@@ -2104,7 +2109,7 @@
*/
public void setOutputStream(java.io.OutputStream os)
{
- SourceTreeHandler handler = new SourceTreeHandler(m_transformerImpl);
+ TransformerHandlerImpl handler = new
TransformerHandlerImpl(m_transformerImpl, false, null);
handler.setResult(new StreamResult(os));
}
@@ -2259,7 +2264,7 @@
*/
public void setStylesheetParam(String key, XObject value)
{
- setParameter(key, value);
+ setParameter(key, value.object());
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]