src/main/java/org/jboss/util/xml/XmlHelper.java
public static Element getUniqueChild(Element element, String tagName)
      throws Exception
   {
      Iterator goodChildren = getChildrenByTagName(element, tagName);

      if (goodChildren != null && goodChildren.hasNext()) {
         Element child = (Element)goodChildren.next();
         if (goodChildren.hasNext()) {
            throw new Exception
               ("expected only one " + tagName + " tag");
         }
         return child;
      } else {
         throw new Exception
            ("expected one " + tagName + " tag");
      }
   }
public static Element getUniqueChild(Element element, String tagName)
      throws Exception
   {
      Iterator goodChildren = getChildrenByTagName(element, tagName);

      if (goodChildren != null && goodChildren.hasNext()) {
         Element child = (Element)goodChildren.next();
         if (goodChildren.hasNext()) {
            throw new Exception
               ("expected only one " + tagName + " tag");
         }
         return child;
      } else {
         throw new Exception
            ("expected one " + tagName + " tag");
      }
   }
Gets the child of the specified element having the specified unique
name.  If there are more than one children elements with the same name
and exception is thrown.

@param element    The parent element
@param tagName    The name of the desired child
@return           The named child.

@throws Exception   Child was not found or was not unique.