FileDocCategorySizeDatePackage
DOMUtil.javaAPI DocExample834Sat Apr 23 22:35:42 BST 2005None

DOMUtil

public class DOMUtil extends Object

Fields Summary
Constructors Summary
Methods Summary
public static org.w3c.dom.ElementgetFirstElement(org.w3c.dom.Element element, java.lang.String name)

		NodeList nl = element.getElementsByTagName( name );
		if ( nl.getLength() < 1 )
			throw new RuntimeException(
				"Element: "+element+" does not contain: "+name);
		return (Element)nl.item(0);
	
public static java.lang.StringgetSimpleElementText(org.w3c.dom.Element node, java.lang.String name)

		Element namedElement = getFirstElement( node, name );
		return getSimpleElementText( namedElement );
	
public static java.lang.StringgetSimpleElementText(org.w3c.dom.Element node)

		StringBuffer sb = new StringBuffer();
		NodeList children = node.getChildNodes();
		for(int i=0; i<children.getLength(); i++) {
			Node child = children.item(i);
			if ( child instanceof Text )
				sb.append( child.getNodeValue() );
		}
		return sb.toString();