diff options
author | harald.bratko <harald.bratko@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2005-07-22 16:07:10 +0000 |
---|---|---|
committer | harald.bratko <harald.bratko@d688527b-c9ab-4aba-bd8d-4036d912da1d> | 2005-07-22 16:07:10 +0000 |
commit | d040b091d0e8556a536978fe830e5db7695e5bef (patch) | |
tree | 6992a6a96f6ce4f1729283a31b10306f77e81441 /common/src/at/gv/egovernment/moa/util/DOMUtils.java | |
parent | ad7665736f08ebdc53e321b4b8e432f17b84a78e (diff) | |
download | moa-id-spss-d040b091d0e8556a536978fe830e5db7695e5bef.tar.gz moa-id-spss-d040b091d0e8556a536978fe830e5db7695e5bef.tar.bz2 moa-id-spss-d040b091d0e8556a536978fe830e5db7695e5bef.zip |
updated for MAO WID (wbPK)
git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@400 d688527b-c9ab-4aba-bd8d-4036d912da1d
Diffstat (limited to 'common/src/at/gv/egovernment/moa/util/DOMUtils.java')
-rw-r--r-- | common/src/at/gv/egovernment/moa/util/DOMUtils.java | 22 |
1 files changed, 22 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 53b1a0e48..52f6554d5 100644 --- a/common/src/at/gv/egovernment/moa/util/DOMUtils.java +++ b/common/src/at/gv/egovernment/moa/util/DOMUtils.java @@ -41,6 +41,7 @@ import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; + import at.gv.egovernment.moa.logging.Logger; /** @@ -832,5 +833,26 @@ public class DOMUtils { } return false; } + + /** + * Selects the (first) element from a node list and returns it. + * + * @param nl The NodeList to get the element from. + * @return The (first) element included in the node list or <code>null</code> + * if the node list is <code>null</code> or empty or no element is + * included in the list. + */ + public static Element getElementFromNodeList (NodeList nl) { + if ((nl == null) || (nl.getLength() == 0)) { + return null; + } + for (int i=0; i<nl.getLength(); i++) { + Node node = nl.item(i); + if (node.getNodeType() == Node.ELEMENT_NODE) { + return (Element)node; + } + } + return null; + } } |