Merge "BUG-509: merge InMemoryDataTreeModification.resolveSnapshot()"
[controller.git] / opendaylight / netconf / config-netconf-connector / src / main / java / org / opendaylight / controller / netconf / confignetconfconnector / mapping / attributes / toxml / SimpleIdentityRefAttributeWritingStrategy.java
index 7c90355051beaee44368a52a3dc0a20f08477140..a2b8e0bfdf6b97a5cc4cdf1e361084e6be0d1078 100644 (file)
@@ -14,13 +14,13 @@ import org.opendaylight.controller.netconf.confignetconfconnector.util.Util;
 import org.opendaylight.controller.netconf.util.xml.XmlUtil;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
+import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
-import org.w3c.dom.Element;
 
 public class SimpleIdentityRefAttributeWritingStrategy extends SimpleAttributeWritingStrategy {
 
-    private static final char QNAME_SEPARATOR = ':';
     private static final String PREFIX = "prefix";
 
     /**
@@ -41,13 +41,10 @@ public class SimpleIdentityRefAttributeWritingStrategy extends SimpleAttributeWr
     }
 
     @Override
-    protected Element createElement(Document doc, String key, String value) {
+    protected Element createElement(Document doc, String key, String value, Optional<String> namespace) {
         QName qName = QName.create(value);
-        String identity = qName.getLocalName();
-        Element element = XmlUtil.createPrefixedTextElement(doc, key, PREFIX, identity);
-
+        String identityValue = qName.getLocalName();
         String identityNamespace = qName.getNamespace().toString();
-        XmlUtil.addPrefixedNamespaceAttr(element, PREFIX, identityNamespace);
-        return element;
+        return XmlUtil.createTextElementWithNamespacedContent(doc, key, PREFIX, identityNamespace, identityValue);
     }
 }