Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xmlns

 
ravindra patil
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI I am facing issue in generating xml
i want to generate xml like

<book>
<name>richdadpoordad</name>
</book>

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">
<name>richdadpoordad</>
it get output as
<book xmlns="http:\\www.libary.com\book">
<name xmlns="">richdadpoordad</>
</book>

see child element automatically adds blank xmlns ,

how to avoid that

Thanks ++

Ravi



 
Madhan Sundararajan Devaki
Ranch Hand
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What software are you using to generate the XML?
 
ravindra patil
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we are having domain specific API , have class jdom.Element
 
Paul Clapham
Sheriff
Pie
Posts: 20715
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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






Thanks
Ravi
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic