You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by jo...@apache.org on 2002/01/17 20:17:46 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/lib/sql DTMDocument.java
johng 02/01/17 11:17:46
Modified: java/src/org/apache/xalan/lib/sql DTMDocument.java
Log:
Update for new DTM Model
Revision Changes Path
1.5 +30 -27 xml-xalan/java/src/org/apache/xalan/lib/sql/DTMDocument.java
Index: DTMDocument.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/sql/DTMDocument.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DTMDocument.java 26 Nov 2001 22:08:27 -0000 1.4
+++ DTMDocument.java 17 Jan 2002 19:17:45 -0000 1.5
@@ -91,10 +91,6 @@
*/
public class DTMDocument extends DTMDefaultBaseIterators
{
- // Bitmask for the portion of a DTM Node handle which refers only
- // to the node, without the portion that specifies which DTM it
- // resides in.
- static final int NODEIDENTITYBITS=DTMManager.IDENT_NODE_DEFAULT;
/**
*/
@@ -110,7 +106,7 @@
/**
*/
- private boolean DEBUG = false;
+ private boolean DEBUG = true;
/**
*/
@@ -362,9 +358,13 @@
*/
public int getFirstAttribute( int parm1 )
{
- if (DEBUG) System.out.println("getFirstAttribute("+ (parm1&NODEIDENTITYBITS)+")");
- int nodeIdx = parm1 & NODEIDENTITYBITS;
- if (nodeIdx != DTM.NULL) return makeNodeHandle(m_attribute.elementAt(nodeIdx));
+ if (DEBUG) System.out.println("getFirstAttribute("+ parm1+")");
+ int nodeIdx = makeNodeIdentity(parm1);
+ if (nodeIdx != DTM.NULL)
+ {
+ int attribIdx = m_attribute.elementAt(nodeIdx);
+ return makeNodeHandle(attribIdx);
+ }
else return DTM.NULL;
}
@@ -377,7 +377,7 @@
if (DEBUG) System.out.println("getNodeValue(" + parm1 + ")");
try
{
- Object o = m_ObjectArray.getAt(parm1 & NODEIDENTITYBITS);
+ Object o = m_ObjectArray.getAt(makeNodeIdentity(parm1));
if (o != null)
{
return o.toString();
@@ -401,10 +401,11 @@
*/
public XMLString getStringValue( int parm1 )
{
- if (DEBUG) System.out.println("getStringValue(" + parm1 + ")");
+ int nodeIdx = makeNodeIdentity(parm1);
+ if (DEBUG) System.out.println("getStringValue(" + nodeIdx + ")");
try
{
- Object o = m_ObjectArray.getAt(parm1 & NODEIDENTITYBITS);
+ Object o = m_ObjectArray.getAt(nodeIdx);
if (o != null)
{
return m_xstrf.newstr(o.toString());
@@ -428,8 +429,8 @@
*/
public int getNextAttribute( int parm1 )
{
- if (DEBUG) System.out.println("getNextAttribute(" + parm1 + ")");
- int nodeIdx = parm1 & NODEIDENTITYBITS;
+ int nodeIdx = makeNodeIdentity(parm1);
+ if (DEBUG) System.out.println("getNextAttribute(" + nodeIdx + ")");
if (nodeIdx != DTM.NULL) return makeNodeHandle(m_nextsib.elementAt(nodeIdx));
else return DTM.NULL;
}
@@ -491,18 +492,18 @@
for (int i = 0; i < nRecords; i++)
{
ps.println("=========== " + i + " ===========");
- ps.println("NodeName: " + getNodeName(i));
- ps.println("NodeNameX: " + getNodeNameX(i));
- ps.println("LocalName: " + getLocalName(i));
- ps.println("NamespaceURI: " + getNamespaceURI(i));
- ps.println("Prefix: " + getPrefix(i));
+ ps.println("NodeName: " + getNodeName(makeNodeHandle(i)));
+ ps.println("NodeNameX: " + getNodeNameX(makeNodeHandle(i)));
+ ps.println("LocalName: " + getLocalName(makeNodeHandle(i)));
+ ps.println("NamespaceURI: " + getNamespaceURI(makeNodeHandle(i)));
+ ps.println("Prefix: " + getPrefix(makeNodeHandle(i)));
- int exTypeID = getExpandedTypeID(i);
+ int exTypeID = getExpandedTypeID(makeNodeHandle(i));
ps.println("Expanded Type ID: "
+ Integer.toHexString(exTypeID));
- int type = getNodeType(i);
+ int type = getNodeType(makeNodeHandle(i));
String typestring;
switch (type)
@@ -633,7 +634,7 @@
* @return
* @throws org.xml.sax.SAXException
*/
- protected static void dispatchNodeData( Node node, ContentHandler ch, int depth )throws org.xml.sax.SAXException
+ protected static void dispatchNodeData( Node node, ContentHandler ch, int depth )throws org.xml.sax.SAXException
{
switch (node.getNodeType())
@@ -741,7 +742,8 @@
*/
public String getLocalName( int parm1 )
{
- int exID = this.getExpandedTypeID( parm1 & NODEIDENTITYBITS );
+// int exID = this.getExpandedTypeID( makeNodeIdentity(parm1) );
+ int exID = getExpandedTypeID(parm1);
if (DEBUG)
{
@@ -760,7 +762,8 @@
*/
public String getNodeName( int parm1 )
{
- int exID = this.getExpandedTypeID( parm1 & NODEIDENTITYBITS );
+// int exID = getExpandedTypeID( makeNodeIdentity(parm1) );
+ int exID = getExpandedTypeID( parm1 );
if (DEBUG)
{
DEBUG = false;
@@ -862,7 +865,7 @@
* @return
* @throws org.xml.sax.SAXException
*/
- public void dispatchToEvents( int parm1, ContentHandler parm2 )throws org.xml.sax.SAXException
+ public void dispatchToEvents( int parm1, ContentHandler parm2 )throws org.xml.sax.SAXException
{
if (DEBUG)
{
@@ -893,7 +896,7 @@
* @return
* @throws org.xml.sax.SAXException
*/
- public void dispatchCharactersEvents( int nodeHandle, ContentHandler ch, boolean normalize )throws org.xml.sax.SAXException
+ public void dispatchCharactersEvents( int nodeHandle, ContentHandler ch, boolean normalize )throws org.xml.sax.SAXException
{
if (DEBUG)
{
@@ -1312,8 +1315,8 @@
if (DEBUG)
{
DEBUG=false;
- System.out.print("getNodeType(" + (parm1 & NODEIDENTITYBITS) + ") ");
- int exID = this.getExpandedTypeID( parm1 & NODEIDENTITYBITS );
+ System.out.print("getNodeType(" + parm1 + ") ");
+ int exID = getExpandedTypeID(parm1);
String name = getLocalNameFromExpandedNameID(exID);
System.out.println(
".. Node name [" + name + "]" +
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org