• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Dom4j problem

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, im using dom4j for creating a DOM and when im trying to do that

What gives me that code


What i want to..


It was working with old version of dom4j, i see that the problem is relying on putting a namespace as attribute, but i dont know how to do that, cause when i put to a namespace it's creating me with xmlns:xmlns="url"




Im using java 1.4.
Thanks in advanced.
 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should consider using java 1.6.
Maybe it will help you http://dom4j.sourceforge.net/dom4j-1.4/apidocs/
 
Ignacio Vazquez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it doesnt care that, dom4j is jdk 1.4 compilant
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, that's right, the Java version is completely irrelevant.

You're using the wrong version of the createElement method. Since you're trying to create an element which is in a namespace, you should use the version which takes a QName rather than the version which takes a String. Be warned that since it's a default namespace, all of your elements in that example are in that namespace as well, so they should be created using a QName as well.

At least I think that's the case -- the API documentation which matias referred to has absolutely no text which explains anything. What a piece of junk.

Probably older versions of dom4j allowed you to cheat and insert namespace declarations as if they were attributes. They aren't attributes, so it looks like the newer versions have fixed that bug.
 
Ignacio Vazquez
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it works



thank you very much!!
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Excellent! You made that fix very quickly.
 
reply
    Bookmark Topic Watch Topic
  • New Topic