- Element response = handle(document, operationElement, opRouter);
-
- Element rpcReply = document.createElementNS(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0,
- XmlNetconfConstants.RPC_REPLY_KEY);
- rpcReply.appendChild(response);
+ Element response = handle(document, operationElement, subsequentOperation);
+ Element rpcReply = XmlUtil.createElement(document, XmlNetconfConstants.RPC_REPLY_KEY, Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));
+
+ if(XmlElement.fromDomElement(response).hasNamespace()) {
+ rpcReply.appendChild(response);
+ } else {
+ Element responseNS = XmlUtil.createElement(document, response.getNodeName(), Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));
+ NodeList list = response.getChildNodes();
+ while(list.getLength()!=0) {
+ responseNS.appendChild(list.item(0));
+ }
+ rpcReply.appendChild(responseNS);
+ }