--- JDOMNamespacePointer.java	Fri Aug  7 11:18:31 2009
+++ NamespacePointer.java	Fri Aug  7 11:18:10 2009
@@ -1,13 +1,13 @@
 /*
- * $Header: /home/cvs/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/jdom/JDOMNamespacePointer.java,v 1.6 2003/03/11 00:59:33 dmitri Exp $
- * $Revision: 1.6 $
- * $Date: 2003/03/11 00:59:33 $
+ * $Header: /home/cvspublic/jakarta-commons/jxpath/src/java/org/apache/commons/jxpath/ri/model/dom/NamespacePointer.java,v 1.4 2002/05/29 00:40:58 dmitri Exp $
+ * $Revision: 1.4 $
+ * $Date: 2002/05/29 00:40:58 $
  *
  * ====================================================================
  * The Apache Software License, Version 1.1
  *
  *
- * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
+ * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -59,109 +59,100 @@
  * For more information on the Apache Software Foundation, please see
  * <http://www.apache.org/>.
  */
-package org.apache.commons.jxpath.ri.model.jdom;
+package org.apache.commons.jxpath.ri.model.dom;
 
+import org.apache.commons.jxpath.ri.Compiler;
 import org.apache.commons.jxpath.ri.QName;
+import org.apache.commons.jxpath.ri.compiler.NodeTest;
+import org.apache.commons.jxpath.ri.compiler.NodeTypeTest;
 import org.apache.commons.jxpath.ri.model.NodePointer;
 
 /**
  * Represents a namespace node.
  *
  * @author Dmitri Plotnikov
- * @version $Revision: 1.6 $ $Date: 2003/03/11 00:59:33 $
+ * @version $Revision: 1.4 $ $Date: 2002/05/29 00:40:58 $
  */
-public class JDOMNamespacePointer extends NodePointer {
+public class NamespacePointer extends NodePointer {
     private String prefix;
     private String namespaceURI;
 
-    public JDOMNamespacePointer(NodePointer parent, String prefix) {
+    public NamespacePointer(NodePointer parent, String prefix){
         super(parent);
         this.prefix = prefix;
     }
 
-    public JDOMNamespacePointer(
-            NodePointer parent,
-            String prefix,
-            String namespaceURI) 
-    {
+    public NamespacePointer(NodePointer parent, String prefix, String namespaceURI){
         super(parent);
         this.prefix = prefix;
         this.namespaceURI = namespaceURI;
     }
 
-    public QName getName() {
+    public QName getName(){
         return new QName(getNamespaceURI(), prefix);
     }
 
-    public Object getBaseValue() {
+    public Object getBaseValue(){
         return null;
     }
-    
-    public boolean isCollection() {
-        return false;
-    }
-    
-    public int getLength() {
-        return 1;
-    }    
 
-    public Object getImmediateNode() {
+    public Object getNodeValue(){
         return getNamespaceURI();
     }
 
-    public String getNamespaceURI() {
-        if (namespaceURI == null) {
+    public String getNamespaceURI(){
+        if (namespaceURI == null){
             namespaceURI = parent.getNamespaceURI(prefix);
         }
         return namespaceURI;
     }
 
-    public boolean isLeaf() {
+    public boolean isLeaf(){
         return true;
     }
 
     /**
      * Throws UnsupportedOperationException.
      */
-    public void setValue(Object value) {
-        throw new UnsupportedOperationException("Cannot modify a namespace");
+    public void setValue(Object value){
+        throw new UnsupportedOperationException("Cannot modify DOM trees");
     }
 
-    public String asPath() {
+    public boolean testNode(NodeTest nodeTest){
+        return nodeTest == null ||
+                ((nodeTest instanceof NodeTypeTest) &&
+                    ((NodeTypeTest)nodeTest).getNodeType() == Compiler.NODE_TYPE_NODE);
+    }
+
+    public String asPath(){
         StringBuffer buffer = new StringBuffer();
-        if (parent != null) {
+        if (parent != null){
             buffer.append(parent.asPath());
-            if (buffer.length() == 0
-                || buffer.charAt(buffer.length() - 1) != '/') {
-                buffer.append('/');
-            }
+            buffer.append('/');
         }
         buffer.append("namespace::");
         buffer.append(prefix);
         return buffer.toString();
     }
 
-    public int hashCode() {
+    public int hashCode(){
         return prefix.hashCode();
     }
 
-    public boolean equals(Object object) {
-        if (object == this) {
+    public boolean equals(Object object){
+        if (object == this){
             return true;
         }
 
-        if (!(object instanceof JDOMNamespacePointer)) {
+        if (!(object instanceof NamespacePointer)){
             return false;
         }
 
-        JDOMNamespacePointer other = (JDOMNamespacePointer) object;
+        NamespacePointer other = (NamespacePointer)object;
         return prefix.equals(other.prefix);
     }
 
-    public int compareChildNodePointers(
-        NodePointer pointer1,
-        NodePointer pointer2) 
-    {
+    public int compareChildNodePointers(NodePointer pointer1, NodePointer pointer2){
         // Won't happen - namespaces don't have children
         return 0;
     }
