You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mo...@apache.org on 2001/12/11 14:10:57 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util ResultTreeType.java

morten      01/12/11 05:10:57

  Modified:    java/src/org/apache/xalan/xsltc/compiler/util
                        ResultTreeType.java
  Log:
  A fix for passing result tree fragments and node-sets to external Java
  methods. Node sets and RTFs can both be handled as org.w3c.dom.Node or
  org.w3c.dom.NodeList in the called method.
  PR:		none
  Obtained from:	n/a
  Submitted by:	morten@xml.apache.org
  Reviewed by:	morten@xml.apache.org
  
  Revision  Changes    Path
  1.9       +16 -4     xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ResultTreeType.java
  
  Index: ResultTreeType.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ResultTreeType.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ResultTreeType.java	2001/10/30 15:35:30	1.8
  +++ ResultTreeType.java	2001/12/11 13:10:57	1.9
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: ResultTreeType.java,v 1.8 2001/10/30 15:35:30 morten Exp $
  + * @(#)$Id: ResultTreeType.java,v 1.9 2001/12/11 13:10:57 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -400,10 +400,22 @@
       public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, 
   			    Class clazz) {
   	final String className = clazz.getName();
  -	if (className.equals("org.w3c.dom.Node") ||
  -	    className.equals("org.w3c.dom.NodeList")) {
  +	final ConstantPoolGen cpg = classGen.getConstantPool();
  +	final InstructionList il = methodGen.getInstructionList();
  +
  +	if (className.equals("org.w3c.dom.Node")) {
   	    translateTo(classGen, methodGen, Type.NodeSet);
  -	    Type.NodeSet.translateTo(classGen, methodGen, clazz);
  +	    int index = cpg.addInterfaceMethodref(DOM_INTF,
  +						  MAKE_NODE,
  +						  MAKE_NODE_SIG2);
  +	    il.append(new INVOKEINTERFACE(index, 2));
  +	}
  +	else if (className.equals("org.w3c.dom.NodeList")) {
  +	    translateTo(classGen, methodGen, Type.NodeSet);
  +	    int index = cpg.addInterfaceMethodref(DOM_INTF,
  +						  MAKE_NODE_LIST,
  +						  MAKE_NODE_LIST_SIG2);
  +	    il.append(new INVOKEINTERFACE(index, 2));
   	}
   	else {
   	    ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org