Add prefixes to type attribute in generated xml from netconf
[controller.git] / opendaylight / netconf / config-netconf-connector / src / main / java / org / opendaylight / controller / netconf / confignetconfconnector / mapping / attributes / toxml / ObjectNameAttributeWritingStrategy.java
index b88b6722c82d5fac9cd4423c32c42d30b543477a..8563b781e3403ba1e45c1bd06f15d2c1c536a51e 100644 (file)
@@ -37,8 +37,11 @@ public class ObjectNameAttributeWritingStrategy implements AttributeWritingStrat
 
         String moduleName = ((ObjectNameAttributeMappingStrategy.MappedDependency) value).getServiceName();
         String refName = ((ObjectNameAttributeMappingStrategy.MappedDependency) value).getRefName();
+        String namespaceForType = ((ObjectNameAttributeMappingStrategy.MappedDependency) value).getNamespace();
 
-        final Element typeElement = XmlUtil.createTextElement(document, XmlNetconfConstants.TYPE_KEY, moduleName);
+        Element typeElement = XmlUtil.createPrefixedTextElement(document, XmlNetconfConstants.TYPE_KEY, XmlNetconfConstants.PREFIX,
+                moduleName);
+        XmlUtil.addPrefixedNamespaceAttr(typeElement, XmlNetconfConstants.PREFIX, namespaceForType);
         innerNode.appendChild(typeElement);
 
         final Element nameElement = XmlUtil.createTextElement(document, XmlNetconfConstants.NAME_KEY, refName);