Author: bombe
Date: 2007-11-03 20:09:03 +0000 (Sat, 03 Nov 2007)
New Revision: 15677
Modified:
trunk/freenet/src/freenet/support/
trunk/freenet/src/freenet/support/HTMLNode.java
Log:
r12815 at natrium: bombe | 2007-11-01 14:35:44 +0100
add getFirstTag() method
Property changes on: trunk/freenet/src/freenet/support
___________________________________________________________________
Name: svk:merge
-
6a5e1407-ac3d-0410-81af-9028a69beae8:/branch/freenet-documentation-browser/src/freenet/support:12814
+
6a5e1407-ac3d-0410-81af-9028a69beae8:/branch/freenet-documentation-browser/src/freenet/support:12815
Modified: trunk/freenet/src/freenet/support/HTMLNode.java
===================================================================
--- trunk/freenet/src/freenet/support/HTMLNode.java 2007-11-03 20:08:15 UTC
(rev 15676)
+++ trunk/freenet/src/freenet/support/HTMLNode.java 2007-11-03 20:09:03 UTC
(rev 15677)
@@ -130,6 +130,27 @@
return addChild(new HTMLNode(nodeName, attributeNames,
attributeValues, content));
}
+ /**
+ * Returns the name of the first "real" tag found in the hierarchy below
+ * this node.
+ *
+ * @return The name of the first "real" tag, or <code>null</code> if no
+ * "real" tag could be found
+ */
+ public String getFirstTag() {
+ if (!name.equals("#")) {
+ return name;
+ }
+ for (int childIndex = 0, childCount = children.size();
childIndex < childCount; childIndex++) {
+ HTMLNode childNode = (HTMLNode)
children.get(childIndex);
+ String tag = childNode.getFirstTag();
+ if (tag != null) {
+ return tag;
+ }
+ }
+ return null;
+ }
+
public String generate() {
StringBuffer tagBuffer = new StringBuffer();
return generate(tagBuffer).toString();