You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by le...@locus.apache.org on 2000/05/03 04:05:14 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/dom ElementImpl.java

lehors      00/05/02 19:05:14

  Modified:    java/src/org/w3c/dom Element.java
               java/src/org/apache/xerces/dom ElementImpl.java
  Log:
  implemented new methods: hasAttribute and hasAttributeNS
  
  Revision  Changes    Path
  1.4       +27 -0     xml-xerces/java/src/org/w3c/dom/Element.java
  
  Index: Element.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/w3c/dom/Element.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Element.java	2000/02/22 00:14:58	1.3
  +++ Element.java	2000/05/03 02:05:13	1.4
  @@ -276,5 +276,32 @@
       public NodeList getElementsByTagNameNS(String namespaceURI, 
                                              String localName);
   
  +    /**
  +     *  Returns <code>true</code> when an attribute with a given name is 
  +     * specified on this element or has a default value, <code>false</code> 
  +     * otherwise.
  +     * @param name  The name of the attribute to look for.
  +     * @return <code>true</code> if an attribute with the given name is 
  +     *   specified on this element or has a default value, <code>false</code> 
  +     *   otherwise.
  +     * @since DOM Level 2
  +     */
  +    public boolean hasAttribute(String name);
  +
  +    /**
  +     *  Returns <code>true</code> when an attribute with a given local name 
  +     * and namespace URI is specified on this element or has a default value, 
  +     * <code>false</code> otherwise. HTML-only DOM implementations do not 
  +     * need to implement this method.
  +     * @param namespaceURI  The  namespace URI of the attribute to look for.
  +     * @param localName  The  local name of the attribute to look for.
  +     * @return <code>true</code> if an attribute with the given local name and 
  +     *   namespace URI is specified or has a default value on this element, 
  +     *   <code>false</code> otherwise.
  +     * @since DOM Level 2
  +     */
  +    public boolean hasAttributeNS(String namespaceURI, 
  +                                  String localName);
  +
   }
   
  
  
  
  1.20      +14 -0     xml-xerces/java/src/org/apache/xerces/dom/ElementImpl.java
  
  Index: ElementImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/dom/ElementImpl.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ElementImpl.java	2000/04/10 22:08:11	1.19
  +++ ElementImpl.java	2000/05/03 02:05:14	1.20
  @@ -672,6 +672,20 @@
       
       /**
        * Introduced in DOM Level 2. <p>
  +     */
  +    public boolean hasAttribute(String name) {
  +        return getAttribute(name) != null;
  +    }
  +
  +    /**
  +     * Introduced in DOM Level 2. <p>
  +     */
  +    public boolean hasAttributeNS(String namespaceURI, String localName) {
  +        return getAttributeNS(namespaceURI, localName) != null;
  +    }
  +
  +    /**
  +     * Introduced in DOM Level 2. <p>
        *
        * Returns a NodeList of all the Elements with a given local name and
        * namespace URI in the order in which they would be encountered in a preorder