/* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ package org.jboss.metadata; import java.util.ArrayList; import java.util.Iterator; import java.util.Collection; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.w3c.dom.Node; import org.jboss.deployment.DeploymentException; /** * An abstract base class for metadata containers. * * @author Sebastien Alborini * @version $Revision: 1.21 $ */ public abstract class MetaData implements Cloneable, XmlLoadable { // Constants ----------------------------------------------------- // These do not really belong here public static final byte TX_NOT_SUPPORTED = 0; public static final byte TX_REQUIRED = 1; public static final byte TX_SUPPORTS = 2; public static final byte TX_REQUIRES_NEW = 3; public static final byte TX_MANDATORY = 4; public static final byte TX_NEVER = 5; public static final byte TX_UNKNOWN = 6; // Attributes ---------------------------------------------------- // Static -------------------------------------------------------- /** * Returns an iterator over the children of the given element with * the given tag name. * * @param element The parent element * @param tagName The name of the desired child * @return An interator of children or null if element is null. */ public static Iterator getChildrenByTagName(Element element, String tagName) { if (element == null) return null; // getElementsByTagName gives the corresponding elements in the whole // descendance. We want only children NodeList children = element.getChildNodes(); ArrayList goodChildren = new ArrayList(); for (int i=0; i= 0; } // Private ------------------------------------------------------- // Inner classes ------------------------------------------------- } /* vim:ts=3:sw=3:et */