Default namespace with prefix for single XML element in JAVA

I want my xml element as follows
<exElement xmlns="urn:hl7-org:v3" xmlns:xsi="">

I used the following code

"xsd", "");

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

<exElement xmlns:ns0="urn:hl7-org:v3" xsi:ns1="">

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

Last updated:11/6/2014 12:47:34 AM

1 Answers

marcel ethan
marcel ethan

Try this :

I am using xom library for XML-manipulation :

Element root = new Element("exElement");

Document document = new Document(root);
System.out.println("XML :: " + document.toXML());

that's working fine for me & give me result :

XML :: <?xml version="1.0"?>
<exElement xmlns="urn:hl7-org:v3" xmlns:xsi="" />

still some problem post me.