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/05/21 18:25:13 UTC
cvs commit: xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm SAX2RTFDTM.java
jkesselm 02/05/21 09:25:12
Modified: java/src/org/apache/xml/dtm/ref/sax2dtm SAX2RTFDTM.java
Log:
Root node is not always 0 in an RTFDTM
Revision Changes Path
1.4 +20 -0 xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java
Index: SAX2RTFDTM.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SAX2RTFDTM.java 8 Feb 2002 23:33:50 -0000 1.3
+++ SAX2RTFDTM.java 21 May 2002 16:25:12 -0000 1.4
@@ -194,6 +194,26 @@
}
/**
+ * Given a node identifier, find the owning document node. Unlike the DOM,
+ * this considers the owningDocument of a Document to be itself. Note that
+ * in shared DTMs this may not be zero.
+ *
+ * @param nodeIdentifier the id of the starting node.
+ * @return int Node identifier of the root of this DTM tree
+ */
+ protected int _documentRoot(int nodeIdentifier)
+ {
+ if(nodeIdentifier==NULL) return NULL;
+
+ for(int parent=_parent(nodeIdentifier);
+ parent!=NULL;
+ nodeIdentifier=parent,parent=_parent(nodeIdentifier))
+ ;
+
+ return nodeIdentifier;
+ }
+
+ /**
* Receive notification of the beginning of a new RTF document.
*
* %REVIEW% Y'know, this isn't all that much of a deoptimization. We
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org