Code example for Attr

Methods: getNamespaceURI, getValue

0
    } 
 
    @Override 
    public void visitAttribute(XmlContext context, Attr attribute) {
        String value = attribute.getValue();
        if (value.length() > 0 && (value.charAt(0) != '@' && value.charAt(0) != '?')) {
            // Make sure this is really one of the android: attributes 
            if (!ANDROID_URI.equals(attribute.getNamespaceURI())) {
                return; 
            } 
 
            context.report(ISSUE, attribute, context.getLocation(attribute),
                    String.format("[I18N] Hardcoded string \"%1$s\", should use @string resource",
                            value), null);
        } 
    } 
}