private void filterAttributes(final TagNode node) { final Element allowedElement = elements.get(node.getName()); final Map<String, String> attributes = node.getAttributes().entrySet().stream() .filter(attribute -> allowedElement.hasAttribute(attribute.getKey())) .collect(Collectors.toMap(attribute -> attribute.getKey(), attribute -> { final String value = attribute.getValue(); final String normalizedValue = cleanCRLFTAB(CharacterReferenceNormalizer.normalize(value.toLowerCase().trim())); if (omitJavascriptProtocol && (normalizedValue.startsWith(JAVASCRIPT_PROTOCOL) || checkDataAttrValue(node.getName(), attribute.getKey(), normalizedValue))) { return ""; } return value; })); node.setAttributes(attributes); }
Map<String, String> attributes = startTagToken.getAttributes(); attributes.put("xmlns", "http://www.w3.org/1999/xhtml"); startTagToken.setAttributes(attributes);
tagNode.setAttributes(transformations.transformAttributes(originalTagName, tagNode.getAttributes()));
tagNode.setAttributes(transformations.transformAttributes(originalTagName, tagNode.getAttributesInLowerCase()));