forum

Home / DeveloperSection / Forums / Default namespace with prefix for single XML element in JAVA

Default namespace with prefix for single XML element in JAVA

Anonymous User 2513 05-Nov-2014
I want my xml element as follows
<exElement xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema">

I used the following code

rootElement.setAttributeNS("urn:hl7-org:v3",
"xsd", "http://www.w3.org/2001/XMLSchema");

And gives me the Element as follows which is different than what i want.

<exElementxmlns:ns0="urn:hl7-org:v3"xsi:ns1="http://www.w3.org/2001/XMLSchema">

Can anyone please correct my code if there is an issue? Help will be greatly appriciated.


Updated on 06-Nov-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By