You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by oliver fodor <fo...@itc.it> on 2002/11/20 18:29:12 UTC

problem with DOM2DTD

using j xalan 2.4.1, DOM2DTM inparticular, i'd need to retrieve DOM Nodes 
using DTD handles. nevertheless i allways get an error which can be 
demonstrated in the following code :

Node n2 = m_xmlDOM2DTM.getNode(m_xmlDOM2DTM.getHandleOfNode(n));


java.lang.ArrayIndexOutOfBoundsException: -1 < 0	
at java.util.Vector.elementAt(Vector.java:437)	
at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.getNode(DOM2DTM.java:640)	
at D_Normalisation.executeXPathQuery(D_Normalisation.java:107)	
at D_Normalisation.<init>(D_Normalisation.java:62)	
at D_Normalisation.main(D_Normalisation.java:57)
Exception in thread "main"

even if the getHandleOfNode() returns a positive integer (e.g. 7), the 
getNode() or getNodeName() methods throw ArrayIndexOutOfBoundsException

any hint how can i use DOM2DTD to retrieve Nodes?

oliver 


Re: problem with DOM2DTD

Posted by Joseph Kesselman <ke...@us.ibm.com>.
I presume you mean DOM2DTM. (Document Table Model, not Document Type 
Description).

Generally, you should not be accessing DOM2DTM directly; that should be 
reserved for use by Xalan's internal subroutines. Instead, you should be 
calling DTMManager.getHandleOfNode(), and letting it find or construct a 
DTM which contains that node. 

To get back to the node,  call DTMManager.getDTM() with that handle to get 
the DTM which contains this handle, then call its getNode().


Try it that way; if it still fails, I'd want to see a bit more information 
about where your node, DTM Manager, and DTM came from.

______________________________________
Joe Kesselman  / IBM Research