String buildAttrXPath(String name, String... value) {
		StringBuilder sb = new StringBuilder();
		sb.append("//*[@");
		sb.append(name);
		if (value.length == 1) {
			sb.append("='");
			sb.append(value[0]);
			sb.append("'");
		}
		sb.append("]");
		return sb.toString();
	}
String buildAttrXPath ( String name , String ... value ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "//*[@" ) ; sb . append ( name ) ; if ( value . length == 1 ) { sb . append ( "='" ) ; sb . append ( value [ 0 ] ) ; sb . append ( "'" ) ; } sb . append ( "]" ) ; return sb . toString ( ) ; }
Build XPath expression for elements with attribute name and optional value.

@param name attribute name,
@param value optional attribute value.
@return XPath expression.