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/07/19 20:36:24 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/dom ElementImpl.java
lehors 00/07/19 11:36:24
Modified: java/src/org/w3c/dom Element.java
java/src/org/apache/xerces/dom ElementImpl.java
Log:
added new Element.hasAttributes method that just got approved
by W3C DOM WG
Revision Changes Path
1.5 +8 -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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Element.java 2000/05/03 02:05:13 1.4
+++ Element.java 2000/07/19 18:36:22 1.5
@@ -277,6 +277,14 @@
String localName);
/**
+ * Returns whether this element has any attributes.
+ * @return <code>true</code> if this element has any attributes,
+ * <code>false</code> otherwise.
+ * @since DOM Level 2
+ */
+ public boolean hasAttributes();
+
+ /**
* 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.
1.24 +9 -2 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.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- ElementImpl.java 2000/07/07 00:36:12 1.23
+++ ElementImpl.java 2000/07/19 18:36:23 1.24
@@ -686,14 +686,21 @@
} // setAttributeNodeNS(Attr):Attr
/**
- * Introduced in DOM Level 2. <p>
+ * Introduced in DOM Level 2.
*/
+ public boolean hasAttributes() {
+ return (attributes != null && attributes.getLength() != 0);
+ }
+
+ /**
+ * Introduced in DOM Level 2.
+ */
public boolean hasAttribute(String name) {
return getAttributeNode(name) != null;
}
/**
- * Introduced in DOM Level 2. <p>
+ * Introduced in DOM Level 2.
*/
public boolean hasAttributeNS(String namespaceURI, String localName) {
return getAttributeNodeNS(namespaceURI, localName) != null;