public static String getRequiredAttributeValue(
        Node node, String attributeName)
    {
        NamedNodeMap attributes = node.getAttributes();
        Node attributeNode = attributes.getNamedItem(attributeName);
        if (attributeNode == null)
        {
            throw new XmlException(
                "No attribute with name \""+attributeName+"\" found");
        }
        String value = attributeNode.getNodeValue();
        if (value == null)
        {
            throw new XmlException(
                "Attribute with name \""+attributeName+"\" has no value");
        }
        return value;
    }
public static String getRequiredAttributeValue ( Node node , String attributeName ) { NamedNodeMap attributes = node . getAttributes ( ) ; Node attributeNode = attributes . getNamedItem ( attributeName ) ; if ( attributeNode == null ) { throw new XmlException ( "No attribute with name \"" + attributeName + "\" found" ) ; } String value = attributeNode . getNodeValue ( ) ; if ( value == null ) { throw new XmlException ( "Attribute with name \"" + attributeName + "\" has no value" ) ; } return value ; }
Returns the attribute with the given name from the given node.

@param node The node to obtain the attribute from
@param attributeName The name of the attribute
@return The value of the attribute
@throws XmlException If no value of the attribute with the given
name could be obtained.