diff options
author | harald.bratko <harald.bratko@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2005-09-02 10:13:32 +0000 |
---|---|---|
committer | harald.bratko <harald.bratko@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2005-09-02 10:13:32 +0000 |
commit | 6551ddb13f38b3d96719f5c21f10da6ff80d5d13 (patch) | |
tree | f552178aef1c1786fd3ae18bd0c2c7c1564a9f96 /common/src/at/gv/egovernment | |
parent | 6fb182ea445c864219cf15aabffe9c299a9ddc4b (diff) | |
download | moa-id-spss-6551ddb13f38b3d96719f5c21f10da6ff80d5d13.tar.gz moa-id-spss-6551ddb13f38b3d96719f5c21f10da6ff80d5d13.tar.bz2 moa-id-spss-6551ddb13f38b3d96719f5c21f10da6ff80d5d13.zip |
Added method for retrieving child elments of an element.
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@476 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'common/src/at/gv/egovernment')
-rw-r--r-- | common/src/at/gv/egovernment/moa/util/DOMUtils.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/common/src/at/gv/egovernment/moa/util/DOMUtils.java b/common/src/at/gv/egovernment/moa/util/DOMUtils.java index 52f6554d5..fddf16944 100644 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -7,8 +7,10 @@ import java.io.InputStream; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; +import java.util.Vector; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -854,5 +856,26 @@ public class DOMUtils { } return null; } + + /** + * Returns all child elements of the given element. + * + * @param parent The element to get the child elements from. + * + * @return A list including all child elements of the given element. + * Maybe empty if the parent element has no child elements. + */ + public static List getChildElements (Element parent) { + Vector v = new Vector(); + NodeList nl = parent.getChildNodes(); + int length = nl.getLength(); + for (int i=0; i < length; i++) { + Node node = nl.item(i); + if (node.getNodeType() == Node.ELEMENT_NODE) { + v.add((Element)node); + } + } + return v; + } } |