jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hor...@apache.org
Subject cvs commit: jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/xml XPathUtil.java
Date Wed, 15 Sep 2004 20:22:19 GMT
horwat      2004/09/15 13:22:19

  Modified:    standard/doc/web ReleaseNotes.html
               standard/src/org/apache/taglibs/standard/tag/common/xml
                        XPathUtil.java
  Log:
  Bugzilla #31147
  
  Fixed XPath Expression evaluation so that expressions are evaluated relative to the document
Node as opposed to only the document Root.
  
    Kris Schneider
    Flavio Tordini
  
  Revision  Changes    Path
  1.58      +9 -1      jakarta-taglibs/standard/doc/web/ReleaseNotes.html
  
  Index: ReleaseNotes.html
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/doc/web/ReleaseNotes.html,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -r1.57 -r1.58
  --- ReleaseNotes.html	3 Sep 2004 17:09:59 -0000	1.57
  +++ ReleaseNotes.html	15 Sep 2004 20:22:18 -0000	1.58
  @@ -60,9 +60,17 @@
             </ul>
           </td>
         </tr>
  +      <tr>
  +        <td width="27%" height="15">
  +          <div align="center">
  +          <a href="http://nagoya.apache.org/bugzilla/show_bug.cgi?id=31147">31147</a></div>
  +        </td>
  +        <td width="73%" height="15">
  +          <p>Fixed XPath Expression evaluation so that the expressions are evaluated
relative to the document Node as opposed to the document Root.</p>
  +        </td>
  +      </tr>
       </table>
     </blockquote>
  -  </ul>
     </ul>
       <blockquote>
         <p>Other changes and additions:</p>
  
  
  
  1.19      +12 -5     jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java
  
  Index: XPathUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- XPathUtil.java	16 Aug 2004 21:38:29 -0000	1.18
  +++ XPathUtil.java	15 Sep 2004 20:22:19 -0000	1.19
  @@ -433,6 +433,13 @@
           }
           return null;
       }
  +
  +    private static Document getDocumentForNode(Node node) {
  +        Document doc = getDummyDocumentWithoutRoot();
  +        Node importedNode = doc.importNode(node, true);
  +        doc.appendChild(importedNode);
  +        return doc;
  +    }
       
       // The following variable is used for holding the modified xpath string
       // when adapting parameter for Xalan XPath engine, where we need to have
  @@ -675,10 +682,7 @@
                               if ( Class.forName("org.w3c.dom.Node").isInstance(
                                   jstlNodeList.elementAt(0) ) ) { 
                                   Node node = (Node)jstlNodeList.elementAt(0);
  -                                Document doc = getDummyDocumentWithoutRoot();
  -                                Node importedNode = doc.importNode( node, true);
  -                                doc.appendChild (importedNode );
  -                                boundDocument = doc;
  +                                boundDocument = getDocumentForNode(node);
                                   if ( whetherOrigXPath ) {
                                       xpath="/*" + xpath;
                                   }
  @@ -723,7 +727,10 @@
                           }
                       } else if ( Class.forName("org.w3c.dom.Node").isInstance(
                       varObject ) ) {
  -                        boundDocument = (Node)varObject;
  +                        boundDocument = getDocumentForNode((Node)varObject);
  +                        if (whetherOrigXPath) {
  +                            xpath = "/*" + xpath;
  +                        }
                       } else {
                           boundDocument = getDummyDocument();
                           xpath = origXPath;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


Mime
View raw message