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";
/**
}
@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);
}
}