From d040b091d0e8556a536978fe830e5db7695e5bef Mon Sep 17 00:00:00 2001 From: "harald.bratko" Date: Fri, 22 Jul 2005 16:07:10 +0000 Subject: updated for MAO WID (wbPK) git-svn-id: https://joinup.ec.europa.eu/svn/moa-idspss/trunk@400 d688527b-c9ab-4aba-bd8d-4036d912da1d --- .../src/at/gv/egovernment/moa/util/DOMUtils.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'common/src/at/gv/egovernment/moa/util/DOMUtils.java') 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 null + * if the node list is null 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