You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@locus.apache.org on 2000/06/08 22:47:20 UTC

cvs commit: xml-xalan/samples/ApplyXPath XPathAPI.java

sboag       00/06/08 13:47:19

  Modified:    samples/ApplyXPath XPathAPI.java
  Log:
  Fixed bug with namespace resolution in eval(...)
  
  Revision  Changes    Path
  1.3       +6 -3      xml-xalan/samples/ApplyXPath/XPathAPI.java
  
  Index: XPathAPI.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/samples/ApplyXPath/XPathAPI.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XPathAPI.java	2000/03/03 21:55:15	1.2
  +++ XPathAPI.java	2000/06/08 20:47:18	1.3
  @@ -197,14 +197,17 @@
       //    because XPathSupportDefault is weak in a number of areas... perhaps
       //    XPathSupportDefault should be done away with.)
       XPathSupport xpathSupport = new XMLParserLiaisonDefault();
  +    
  +    if(null == namespaceNode)
  +      namespaceNode = contextNode;
   
       // Create an object to resolve namespace prefixes.
       // XPath namespaces are resolved from the input context node's document element
       // if it is a root node, or else the current context node (for lack of a better
       // resolution space, given the simplicity of this sample code).
  -    PrefixResolverDefault prefixResolver = new PrefixResolverDefault((contextNode.getNodeType() == Node.DOCUMENT_NODE)
  -                                                         ? ((Document)contextNode).getDocumentElement() :
  -                                                           contextNode);
  +    PrefixResolverDefault prefixResolver = new PrefixResolverDefault((namespaceNode.getNodeType() == Node.DOCUMENT_NODE)
  +                                                         ? ((Document)namespaceNode).getDocumentElement() :
  +                                                           namespaceNode);
   
       // Create the XPath object.
       XPath xpath = new XPath();