final Pattern nsNamePattern = Pattern.compile("xmlns:.*"); //$NON-NLS-1$
String attributeName = null;
String attributeValue = null;
XMLTokenizer tokenizer = new XMLTokenizer(contents);
String token = tokenizer.primGetNextToken();
while (token != null &&
!DOMRegionContext.XML_TAG_CLOSE.equals(token) &&
!DOMRegionContext.XML_EMPTY_TAG_CLOSE.equals(token)) {
if (DOMRegionContext.XML_TAG_ATTRIBUTE_NAME.equals(token)) {
attributeName = tokenizer.yytext();
}
else if (DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(token)) {
attributeValue = StringUtils.strip(tokenizer.yytext());
for (int i = 0; i < nsValuePatterns.length; i++) {
if (nsNamePattern.matcher(attributeName).matches()) {
if (nsValuePatterns[i].matcher(attributeValue).matches()) {
return VALID;
}
}
}
}
token = tokenizer.primGetNextToken();
}
return INVALID;
}