You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by jk...@apache.org on 2002/09/30 17:33:22 UTC
cvs commit: xml-xalan/java/src/org/apache/xml/dtm/ref/dom2dtm DOM2DTMdefaultNamespaceDeclarationNode.java
jkesselm 2002/09/30 08:33:22
Modified: java/src/org/apache/xml/dtm/ref Tag: xslt20
DTMAxisIteratorBase.java
DTMDefaultBaseTraversers.java
DTMManagerDefault.java
java/src/org/apache/xml/dtm/ref/dom2dtm Tag: xslt20
DOM2DTMdefaultNamespaceDeclarationNode.java
Log:
Commiting the changes to enable trying out DOM2DTM2, an
experimental version of DOM2DTM. To switch to that code, edit
DTMManagerDefault and define the constant ATTEMPT_DOM2DTM2
as true, then recompile. (It's checked in as
false.)
DOM2DTM2 is intended to be lighter weight
than DOM2DTM (less memory consumption), to
be even more incremental than DOM2DTM (it
will build node mappings out-of-sequence)
and to better handle repeated processing
of the same Document tree (even if it has
been altered between stylesheet invocations).
DOM2DTM2 is *NOT* currently as fast as
DOM2DTM in the basic benchmarks/conformance
tests. Part of this is because we aren't
caching as much data, part of it is because
it has not yet been performance-tuned; I
_know_ there's suboptimal code in some spots.
Note that generated IDs will differ from those
in DOM2DTM and SAX2DTM; that is not an error,
though the conformance test currently reports
it as one.
There are a few genuine bugs.
Highly experimental code. We'll see how it
works out.
Revision Changes Path
No revision
No revision
1.5.16.1 +5 -1 xml-xalan/java/src/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java
Index: DTMAxisIteratorBase.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/DTMAxisIteratorBase.java,v
retrieving revision 1.5
retrieving revision 1.5.16.1
diff -u -r1.5 -r1.5.16.1
--- DTMAxisIteratorBase.java 7 Aug 2001 19:16:42 -0000 1.5
+++ DTMAxisIteratorBase.java 30 Sep 2002 15:33:22 -0000 1.5.16.1
@@ -238,7 +238,11 @@
* <br />
* would probably optimize just about as well and avoid questions
* about whether what's returned could ever be different from what's
- * passed in.
+ * passed in.. and
+ * <br />
+ * <code> _position++; return node; </code>
+ * <br />
+ * would avoid any risk of call-and-return overhead...
*
* @param node Node handle which iteration is about to yield.
*
1.11.2.1.2.1 +5 -1 xml-xalan/java/src/org/apache/xml/dtm/ref/DTMDefaultBaseTraversers.java
Index: DTMDefaultBaseTraversers.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/DTMDefaultBaseTraversers.java,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.1.2.1
diff -u -r1.11.2.1 -r1.11.2.1.2.1
--- DTMDefaultBaseTraversers.java 14 Aug 2002 19:45:34 -0000 1.11.2.1
+++ DTMDefaultBaseTraversers.java 30 Sep 2002 15:33:22 -0000 1.11.2.1.2.1
@@ -1152,7 +1152,11 @@
return getParent(context);
}
- /**
+ /**This is actually going to the nearest ancestor of the
+ * specified type, not to the parent-if-it-has-this-type.
+ * I suspect that's incorrect!
+ *
+ * %REVIEW%
* By the nature of the stateless traversal, the context node can not be
* returned or the iteration will go into an infinate loop. So to traverse
* an axis, the first function must be used to get the first node.
1.41.6.1.2.2 +50 -6 xml-xalan/java/src/org/apache/xml/dtm/ref/DTMManagerDefault.java
Index: DTMManagerDefault.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/DTMManagerDefault.java,v
retrieving revision 1.41.6.1.2.1
retrieving revision 1.41.6.1.2.2
diff -u -r1.41.6.1.2.1 -r1.41.6.1.2.2
--- DTMManagerDefault.java 26 Aug 2002 17:58:05 -0000 1.41.6.1.2.1
+++ DTMManagerDefault.java 30 Sep 2002 15:33:22 -0000 1.41.6.1.2.2
@@ -73,12 +73,13 @@
import org.apache.xml.utils.SystemIDResolver;
import org.apache.xml.dtm.ref.dom2dtm.DOM2DTM;
import org.apache.xml.dtm.ref.sax2dtm.SAX2DTM;
-//import org.apache.xml.dtm.ref.sax2dtm.SAX2RTFDTM;
/**************************************************************/
// EXPERIMENTAL 3/22/02
import org.apache.xml.dtm.ref.xni2dtm.XNI2DTM;
import org.apache.xml.dtm.ref.xni2dtm.XNISource;
+// EXPERIMENTAL 9/18/02
+import org.apache.xml.dtm.dom2dtm2.DOM2DTM2;
/**************************************************************/
// W3C DOM
@@ -122,6 +123,12 @@
* */
public class DTMManagerDefault extends DTMManager
{
+ // Set true to attempt loading DOMs via our experimental
+ // DOM2DTM2 wrapper. If false, or if that fails, we fall
+ // back on standard DOM2DTM.
+ private static final boolean ATTEMPT_DOM2DTM2=false;
+
+
/** Set this to true if you want a dump of the DTM after creation. */
private static final boolean DUMPTREE = false;
@@ -287,11 +294,23 @@
if (source instanceof DOMSource)
{
// Simplest case: Wrap a DTM around an existing DOM.
- //
- // %REVIEW% May get more complicated if we start trying to match
- // DOM2DTM implementations against specific DOM implementations,
- // eg taking advantage of a particular DOM's hashability or
- // userData hooks.
+ if(ATTEMPT_DOM2DTM2)
+ {
+ DTM dtm;
+ try
+ {
+ dtm = new DOM2DTM2(this, source, documentID,
+ whiteSpaceFilter, xstringFactory, doIndexing);
+ } catch(ClassCastException e)
+ {
+ dtm = new DOM2DTM(this, (DOMSource) source, documentID,
+ whiteSpaceFilter, xstringFactory, doIndexing);
+ }
+ addDTM(dtm, dtmPos, 0);
+ return dtm;
+ }
+
+
DOM2DTM dtm = new DOM2DTM(this, (DOMSource) source, documentID,
whiteSpaceFilter, xstringFactory, doIndexing);
addDTM(dtm, dtmPos, 0);
@@ -836,6 +855,31 @@
{
if(nodeHandle==DTM.NULL)
return null; // Accept as a special case.
+ else
+ throw e; // Programming error; want to know about it.
+ }
+ }
+
+ /**
+ * Return the offset between this DTM Handle and the internal
+ * node identifier. May be used by makeNodeIdentity to obtain
+ * the high-order bits of that identifier.
+ *
+ * @param nodeHandle DTM Handle indicating which node to retrieve
+ *
+ * @return a reference to the DTM object containing this node.
+ */
+ synchronized public int getDTMoffset(int nodeHandle)
+ {
+ try
+ {
+ // Performance critical function.
+ return m_dtm_offsets[nodeHandle >>> IDENT_DTM_NODE_BITS];
+ }
+ catch(java.lang.ArrayIndexOutOfBoundsException e)
+ {
+ if(nodeHandle==DTM.NULL)
+ return DTM.NULL; // Accept as a special case.
else
throw e; // Programming error; want to know about it.
}
No revision
No revision
1.2.16.1 +27 -3 xml-xalan/java/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java
Index: DOM2DTMdefaultNamespaceDeclarationNode.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/dom2dtm/DOM2DTMdefaultNamespaceDeclarationNode.java,v
retrieving revision 1.2
retrieving revision 1.2.16.1
diff -u -r1.2 -r1.2.16.1
--- DOM2DTMdefaultNamespaceDeclarationNode.java 18 Dec 2001 21:55:33 -0000 1.2
+++ DOM2DTMdefaultNamespaceDeclarationNode.java 30 Sep 2002 15:33:22 -0000 1.2.16.1
@@ -85,15 +85,29 @@
Element pseudoparent;
String prefix,uri,nodename;
- int handle;
- DOM2DTMdefaultNamespaceDeclarationNode(Element pseudoparent,String prefix,String uri,int handle)
+ int handle, id;
+
+ public DOM2DTMdefaultNamespaceDeclarationNode(Element pseudoparent,String prefix,String uri,int handle)
{
this.pseudoparent=pseudoparent;
this.prefix=prefix;
this.uri=uri;
this.handle=handle;
this.nodename="xmlns:"+prefix;
+ this.id=DTM.NULL; // %BUG% %REVIEW%
}
+
+ public DOM2DTMdefaultNamespaceDeclarationNode(Element pseudoparent,String prefix,String uri,int handle,int id)
+ {
+ this.pseudoparent=pseudoparent;
+ this.prefix=prefix;
+ this.uri=uri;
+ this.handle=handle;
+ this.nodename="xmlns:"+prefix;
+ this.id=id; // %BUG% %REVIEW%
+ }
+
+
public String getNodeName() {return nodename;}
public String getName() {return nodename;}
public String getNamespaceURI() {return "http://www.w3.org/2000/xmlns/";}
@@ -127,13 +141,23 @@
public Node cloneNode(boolean deep) {throw new DTMException(NOT_SUPPORTED_ERR);}
/** Non-DOM method, part of the temporary kluge
- * %REVIEW% This would be a pruning problem, but since it will always be
+ * %REVIEW% This could be a pruning problem, but since it will always be
* added to the root element and we prune on elements, we shouldn't have
* to worry.
*/
public int getHandleOfNode()
{
return handle;
+ }
+
+ /** Non-DOM method, part of the temporary kluge
+ * %REVIEW% This would be a pruning problem, but since it will always be
+ * added to the root element and we prune on elements, we shouldn't have
+ * to worry.
+ */
+ public int getIDOfNode()
+ {
+ return id;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org