public static String getAttributeValue ( Node node , String attributeName , String defaultValue ) { NamedNodeMap attributes = node . getAttributes ( ) ; Node attributeNode = attributes . getNamedItem ( attributeName ) ; if ( attributeNode == null ) { return defaultValue ; } String value = attributeNode . getNodeValue ( ) ; if ( value == null ) { return defaultValue ; } return value ; }
Returns the attribute with the given name from the given node . If the respective attribute could not be obtained the given default value will be returned