Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xmlns" Watch "xmlns" New topic


ravindra patil
Ranch Hand

Joined: Sep 01, 2006
Posts: 234
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:\\\book

means <book xmlns="http:\\\book">
it get output as
<book xmlns="http:\\\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: 234
we are having domain specific API , have class jdom.Element
Paul Clapham

Joined: Oct 14, 2005
Posts: 19755

You declared the "book" element to be in the "http:\\\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: 234
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:
subject: xmlns
It's not a secret anymore!