wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes xmlns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xmlns" Watch "xmlns" New topic


ravindra patil
Ranch Hand

Joined: Sep 01, 2006
Posts: 230
HI I am facing issue in generating xml
i want to generate xml like


so i have defined like this wile generating xml

<Book> with xmlns as "http:\\www.libary.com\book

means <book xmlns="http:\\www.libary.com\book">
it get output as
<book xmlns="http:\\www.libary.com\book">
<name xmlns="">richdadpoordad</>

see child element automatically adds blank xmlns ,

how to avoid that

Thanks ++


Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

What software are you using to generate the XML?

Not many get the right opportunity !
ravindra patil
Ranch Hand

Joined: Sep 01, 2006
Posts: 230
we are having domain specific API , have class jdom.Element
Paul Clapham

Joined: Oct 14, 2005
Posts: 18986

You declared the "book" element to be in the "http:\\www.libary.com\book" namespace. Now you have to decide what you want. Do you want the "name" element to be in that namespace, or do you want it to be in no namespace?

You should answer this question rather than deciding based on what the XML document looks like, because you are designing a data structure here. So, what's the answer to that question?
ravindra patil
Ranch Hand

Joined: Sep 01, 2006
Posts: 230
got the issue .. need to add namespace to all child element .. xml file created successfully and also got imported into ms excel successfully

Ravi Rocks Again

I agree. Here's the link: http://aspose.com/file-tools
subject: xmlns