• 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

Missing Namespace URIs

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm new to XML parsing. I'm having a problem where I ouput a DOM document using an identity transformer and for some reason the namespace URI's are missing.

I'm using Java 1.4.1_03. If I add the jars from the latest version of xalan to the classpath, I get my URIs. The problem is that because this is going onto a webserver running a lot of legacy code, they will not allow me to load xalan (and the latest xercesImpl.jar, etc) because of the risk of impacting the existing applications.

I figure there is some feature I have to set, or something else small I'm missing to get the transformer to output the namespace URIs.

I wrote a little test program to demonstrate the problem (see the end of the post). Below is the output from two runs of that test program. The first is with the xalan jars in the classpath. The second is without the xalan jars in the classpath. Notice the namespace URIs disappear. Is there someway, without using the xalan package, I can get the transformer to output the namespace URIs?

With xalan (namespace URIs are present)


Without xalan (namespace URIs are missing)


Test program

[ August 08, 2006: Message edited by: Todd Johnson ]
 
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
I'm sorry to tell you that I had a look through the Java bug database (because leaving off namespace declarations is clearly a bug) and I found this bug report. In which it says

For JDK 1.4, using JAXP identity transforms for namespaced documents is too buggy to consider...

I can't fault your webserver admins for not letting you install your own version of Xalan et al., that sort of thing can easily screw up the workings of the app server. (I've seen it happen in my own setup.) But perhaps if XML serialization is all you need, and not XSLT transformation, you could hunt down some Java code that just serializes a DOM and install that with your app.
 
Todd Johnson
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Paul,

Thanks for the quick reply! Wow! I can't believe it's that broken in 1.4. I don't understand why no one else seems to be complaining as I didn't find much on the net when I searched for this. I guess not many people using 1.4 are using the identity transform to output XML files with namespaces.
 
Hoo hoo hoo! Looks like we got a live one! Here, wave this tiny ad at it:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic