Hi Paul,
Sorry, yesterday I did not post the code I was using . Please find the code I have used to generate the xml.
This code is giving the output
<?xml version = '1.0' encoding = 'UTF-8'?>
<MyOne xmlns:xsi="http://www.meme.com/mynote/v1">
<MyName>EEE</MyName>
<MyExtension>NotesExtension</MyExtension>
<MyText>This is notes</MyText>
</MyOne>
One of the options I tried was to remove the setAttributeNS call for root and use it for each child element. I was getting the following xml as output.
<?xml version = '1.0' encoding = 'UTF-8'?>
<MyOne>
<MyName xmlns:xsi="http://www.meme.com/mynote/v1">EEE</MyName>
<MyExtension xmlns:xsi="http://www.meme.com/mynote/v1">NotesExtension</MyExtension>
<MyText xmlns:xsi="http://www.meme.com/mynote/v1">This is notes</MyText>
</MyOne>
My requirement is to generate xml with namespace present in root and child elements.
Are you just complaining because the namespace declarations are in the root element? An element inherits its namespaces from its parent unless it overrides them with other namespace declarations, you know.
No i'm not complaining that namespace declaration is in root element. Ya, i know that child elements inherit the namespace of enclosing parent.
I just want to know if there is a way to generate the xml with the namespace being displayed.
And I feel that this has nothing to do with the way I'm creating xml.
I was just wondering if there might just be an option I would have to enable while transforming the xml and outputting it so that it might display the namespace for root element and child elements.