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 .