commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r601522 - /commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java
Date Wed, 05 Dec 2007 21:02:03 GMT
Author: mbenson
Date: Wed Dec  5 13:02:01 2007
New Revision: 601522

URL: http://svn.apache.org/viewvc?rev=601522&view=rev
Log:
[JXPATH-104] Add helper method to determine whether a given qname denotes a valid property(ies).

Modified:
    commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java

Modified: commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java?rev=601522&r1=601521&r2=601522&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java
(original)
+++ commons/proper/jxpath/trunk/src/java/org/apache/commons/jxpath/ri/model/beans/PropertyOwnerPointer.java
Wed Dec  5 13:02:01 2007
@@ -48,11 +48,11 @@
         if (test instanceof NodeNameTest) {
             NodeNameTest nodeNameTest = (NodeNameTest) test;
             QName testName = nodeNameTest.getNodeName();
-            if (!isDefaultNamespace(testName.getPrefix())) {
-                return null;
+            if (isValidProperty(testName)) {
+                return createNodeIterator(nodeNameTest.isWildcard() ? null
+                        : testName.toString(), reverse, startWith);
             }
-            String property = nodeNameTest.isWildcard() ? null : testName.getName();
-            return createNodeIterator(property, reverse, startWith);
+            return null;
         }
         return test instanceof NodeTypeTest && ((NodeTypeTest) test).getNodeType()
== Compiler.NODE_TYPE_NODE
                 ? createNodeIterator(null, reverse, startWith) : null;
@@ -97,6 +97,16 @@
     }
 
     public abstract QName getName();
+
+    /**
+     * Learn whether <code>name</code> is a valid child name for this PropertyOwnerPointer.
+     * @param name the QName to test
+     * @return <code>true</code> if <code>QName</code> is a valid
property name.
+     * @since JXPath 1.3
+     */
+    public boolean isValidProperty(QName name) {
+        return isDefaultNamespace(name.getPrefix());
+    }
 
     /**
      * Throws an exception if you try to change the root element, otherwise



Mime
View raw message