on 03-18-2010 8:49 PM
Hi,
I am creating java mapping using DOM, but why i cannot create a namespace using this code ?
Document targetDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
Node docRoot = targetDoc.appendChild(targetDoc.createElementNS("urn:sap-com:atp:ABC40:base", "ns1:Vendor_SQL"));
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
// create source and result wrappers and perform transformation
DOMSource source = new DOMSource(targetDoc);
StreamResult result = new StreamResult(outputStream);
transformer.transform(source, result);
expected result in xml :
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Vendor_SQL xmlns:ns0="urn:sap-com:atp:ABC40:base">
</ns0:Vendor_SQL>
result :
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Vendor_SQL>
</ns0:Vendor_SQL>
Please advise whether i was missing any other required step ?
Note : testing using NWDS 7.0 SP 17
Thank You and Best Regards
Fernand
Hi Lesmana,
Can you change the second line in the code like below and give a try::
Node docRoot = targetDoc.appendChild(targetDoc.createElementNS("ns1:urn:sap-com:atp:ABC40:base", "ns1:Vendor_SQL"));
Regards,
---Saish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.