dmitri      2004/10/05 17:34:14

  Modified:    jxpath/src/java/org/apache/commons/jxpath/ri/model/dom
                        DOMNodePointer.java
               jxpath/src/test/org/apache/commons/jxpath Vendor.xml
               jxpath/src/test/org/apache/commons/jxpath/ri/compiler
                        ExtensionFunctionTest.java
               jxpath/src/test/org/apache/commons/jxpath/ri/model
                        XMLModelTestCase.java
  Log:
  Applied patch by Nick Van den Bleeken, dealing with null default namespace
  
  Revision  Changes    Path
  1.25      +6 -5      
jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java
  
  Index: DOMNodePointer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/DOMNodePointer.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- DOMNodePointer.java       29 Jun 2004 22:58:17 -0000      1.24
  +++ DOMNodePointer.java       6 Oct 2004 00:34:14 -0000       1.25
  @@ -130,11 +130,12 @@
       }
   
       private static boolean equalStrings(String s1, String s2) {
  -        if (s1 == null && s2 != null) {
  -            return false;
  +        if (s1 == null) {
  +            return s2 == null || s2.trim().length() == 0;
           }
  -        if (s1 != null && s2 == null) {
  -            return false;
  +        
  +        if (s2 == null) {
  +            return s1 == null || s1.trim().length() == 0;
           }
   
           if (s1 != null && !s1.trim().equals(s2.trim())) {
  
  
  
  1.10      +7 -0      
jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/Vendor.xml
  
  Index: Vendor.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/Vendor.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Vendor.xml        1 Apr 2004 02:55:31 -0000       1.9
  +++ Vendor.xml        6 Oct 2004 00:34:14 -0000       1.10
  @@ -46,4 +46,11 @@
        <?security do not show anybody ?>
        <?report average only ?>
     </product>
  +
  +  <pos xmlns="temp">  
  +    <register xmlns="">
  +       <number>109</number>
  +    </register>
  +  </pos>
  +
   </vendor>
  
  
  
  1.17      +5 -1      
jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/ExtensionFunctionTest.java
  
  Index: ExtensionFunctionTest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/compiler/ExtensionFunctionTest.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ExtensionFunctionTest.java        4 Apr 2004 23:16:24 -0000       1.16
  +++ ExtensionFunctionTest.java        6 Oct 2004 00:34:14 -0000       1.17
  @@ -225,6 +225,10 @@
               
           context.getValue("add($myList, 'hello')");
           assertEquals("After adding an element", 2, list.size());
  +        
  +        JXPathContext context = JXPathContext.newContext(new ArrayList());
  +        assertEquals("Extension function on root collection", "0", String
  +                .valueOf(context.getValue("size(/)")));
       }
   
       public void testStaticMethodCall() {
  
  
  
  1.24      +5 -1      
jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/XMLModelTestCase.java
  
  Index: XMLModelTestCase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/jxpath/src/test/org/apache/commons/jxpath/ri/model/XMLModelTestCase.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- XMLModelTestCase.java     30 Jun 2004 00:29:13 -0000      1.23
  +++ XMLModelTestCase.java     6 Oct 2004 00:34:14 -0000       1.24
  @@ -375,6 +375,10 @@
   
           // child:: with a qualified name
           assertXPathValue(context, "vendor/product/price:amount", "45.95");
  +        
  +        // null default namespace
  +        context.registerNamespace("x", "temp");
  +        assertXPathValue(context, "vendor/x:pos//number", "109");
       }
   
       public void testAxisChildIndexPredicate() {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to