sboag       00/07/21 07:49:22

  Modified:    src/org/apache/xalan/xpath SimpleNodeLocator.java
  Log:
  Working on Kent Tamaru's namespace axes patch, but not ready for prime time...
  
  Revision  Changes    Path
  1.25      +63 -31    
xml-xalan/src/org/apache/xalan/xpath/SimpleNodeLocator.java
  
  Index: SimpleNodeLocator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/src/org/apache/xalan/xpath/SimpleNodeLocator.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- SimpleNodeLocator.java    2000/07/19 19:20:56     1.24
  +++ SimpleNodeLocator.java    2000/07/21 14:49:19     1.25
  @@ -682,49 +682,81 @@
      * // PATCH {blocks} PR:DMAN4KPPSQ Submitted by:<[EMAIL PROTECTED]> 
namespace::* axis fix
      */
     private static class AttrProxy implements Attr {
  -    Attr real;
  +    String m_name;
  +    String m_value;
       Element owner;
  +    
       AttrProxy(Node owner, Document factory, String name, String value) {
  -      this.real = factory.createAttribute(name);
  -      this.real.setValue(value);
  +      // int colonpos = name.indexOf(':');
  +      // m_name = (colonpos < 0) ? "" : name.substring(colonpos+1);
  +      m_name = name;
  +      m_value = value;
         this.owner = (Element)owner;
       }
  +    
  +    AttrProxy(AttrProxy copyFrom) {
  +      m_name = copyFrom.m_name;
  +      m_value = copyFrom.m_value;
  +      owner = copyFrom.owner;
  +    }
  +    
       public Element getOwnerElement() {
         return this.owner;
       }
   
  -    public String getName() {  return this.real.getName(); }
  +    public String getName() {  return m_name; }
       public boolean getSpecified() {  return false; }
  -    public String getValue() {  return this.real.getValue(); }
  -    public void setValue(String value) {  this.real.setValue(value); }
  +    public String getValue() {  return m_value; }
  +    public void setValue(String value) {  m_name = value;  }
   
  -    public Node appendChild(Node newChild) {  return 
this.real.appendChild(newChild);  }
  -    public Node cloneNode(boolean deep) {  return this.real.cloneNode(deep); 
 }
  -    public NamedNodeMap getAttributes() {  return this.real.getAttributes(); 
 }
  -    public NodeList getChildNodes() {  return this.real.getChildNodes();  }
  -    public Node getFirstChild() {  return this.real.getFirstChild();  }
  -    public Node getLastChild() {  return this.real.getLastChild();  }
  -    public String getLocalName() {  return this.real.getLocalName();  }
  -    public String getNamespaceURI() {  return this.real.getNamespaceURI();  }
  -    public Node getNextSibling() {  return this.real.getNextSibling();  }
  -    public String getNodeName() {  return this.real.getNodeName();  }
  -    public short getNodeType() {  return this.real.getNodeType();  }
  -    public String getNodeValue() {  return this.real.getNodeValue();  }
  -    public Document getOwnerDocument() {  return 
this.real.getOwnerDocument();  }
  -    public Node getParentNode() {  return this.real.getParentNode();  }
  -    public String getPrefix() {  return this.real.getPrefix();  }
  -    public Node getPreviousSibling() {  return 
this.real.getPreviousSibling();  }
  -    public boolean hasChildNodes() {  return this.real.hasChildNodes();  }
  +    public Node appendChild(Node newChild) 
  +    {  
  +      /* never happens... should assert. */  
  +      return null;
  +    }
  +    public Node cloneNode(boolean deep) 
  +    {  
  +      return new AttrProxy(this);
  +    }
  +    
  +    public NamedNodeMap getAttributes() {  return null; /* a problem */  }
  +    public NodeList getChildNodes() {  return null; /* never happens */  }
  +    public Node getFirstChild() {  return null;  }
  +    public Node getLastChild() {  return null;  }
  +    public String getLocalName() 
  +    {  
  +      return m_name;
  +    }
  +    public String getNamespaceURI() 
  +    {  
  +      return null;  // ?? 
  +    }
  +    public Node getNextSibling() 
  +    {  
  +      return null; // ??  
  +    }
  +    public String getNodeName() {  return m_name;  }
  +    
  +    public short getNodeType() {  return Node.ATTRIBUTE_NODE;  }
  +    public String getNodeValue() {  return m_value;  }
  +    public Document getOwnerDocument() 
  +    {  return this.owner.getOwnerDocument();  }
  +    public Node getParentNode() {  return null;  }
  +    public String getPrefix() {  return "xmlns"; /* I guess */  }
  +    public Node getPreviousSibling() {  return null;  }
  +    public boolean hasChildNodes() {  return false;  }
       public Node insertBefore(Node newChild, Node refChild) {
  -      return this.real.insertBefore(newChild, refChild);  }
  -    public void normalize() {  this.real.normalize();  }
  -    public Node removeChild(Node oldChild) {  return 
this.real.removeChild(oldChild);  }
  -    public Node replaceChild(Node newChild, Node oldChild) {
  -      return this.real.replaceChild(newChild, oldChild);  }
  -    public void setNodeValue(String nodeValue) {  
this.real.setNodeValue(nodeValue);  }
  -    public void setPrefix(String prefix) {  this.real.setPrefix(prefix);  }
  +      return null; /* never happens */  }
  +    public void normalize() {  /* never happens -- can't mutate */  }
  +    public Node removeChild(Node oldChild) {  return null;  }
  +    public Node replaceChild(Node newChild, Node oldChild) 
  +    {
  +      return null;  
  +    }
  +    public void setNodeValue(String nodeValue) {  /* never happens -- can't 
mutate */  }
  +    public void setPrefix(String prefix) {  /* never happens -- can't mutate 
*/  }
       public boolean supports(String feature, String version) {
  -      return this.real.supports(feature, version);  }
  +      return false; /* don't support anything... :-) */  }
     }
   
     private static final String S_XMLNAMESPACEURI = 
PrefixResolverDefault.S_XMLNAMESPACEURI;
  
  
  

Reply via email to