TDI-35076: tXMLMap removing the namespace for attributes

https://jira.talendforge.org/browse/TDI-35076
This commit is contained in:
wang wei
2016-01-18 14:25:58 +08:00
parent c9432e7bf0
commit 6dabb24bd2

View File

@@ -123,4 +123,21 @@ public class DocumentHelper {
org.dom4j.DocumentHelper.createNamespace(prefix,TalendString.replaceSpecialCharForXML(uri))));
}
public static void applyNamespace2Attribute(org.dom4j.Element currentElement, String prefix, String localname, String value) {
if(value == null) {
return;
}
if(prefix == null) {
currentElement.addAttribute(localname, value);
return;
}
Namespace namespace = currentElement.getNamespaceForPrefix(prefix);
if(namespace == null) {
currentElement.addAttribute(localname, value);
}
currentElement.addAttribute(org.dom4j.DocumentHelper.createQName(localname, namespace), value);
}
}