FW: [jdom-interest] & in namespace

Deshpande, Aniruddha Aniruddha.Deshpande at softwareag.com
Tue May 2 22:28:02 PDT 2006


In my code I need to parse a WSDL file. Since WSDL file is an XML file the contents of namespace URI indeed has "&" and not "&".

I have a test case wherein I have written a small XML file which is parsed and printed with outputter.

Please find attached XML and Java source file. Please change the code according to your settings.

If you look into the output of the program "&" is converted back to "&" in every case except for namespaces.

The code just reads a file, creates a JDOM Document object and passes that to XMLOutputter. I think this basic flow should always lead the same XML file and not an invalid XML file!

With Regards,
Aniruddha Deshpande

-----Original Message-----
From: Elliotte Harold [mailto:elharo at metalab.unc.edu] 
Sent: Tuesday, May 02, 2006 5:10 PM
To: Deshpande, Aniruddha
Cc: jdom-interest at jdom.org
Subject: Re: [jdom-interest] & in namespace

Deshpande, Aniruddha wrote:
> Hello,
> I use SAXBuilder to parse and add an extra element to an existing WSDL 
> file. I am facing problem for WSDLs which have & in their namespace 
> declaration. When I use XMLOutputter to write back the changed WSDL 
> “&” gets replaced with “&”.

I don't believe the namespace URI contains &. I suspect it contains 
& which is escaped as & in XML contexts. The distinction is 
critical. However it does sound like you may have uncovered a serious 
bug in JDOM if indeed JDOM does not escape such ampersands when 
reserializing. Do you have a reproducible test case?

Elliotte Rusty Harold  elharo at metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sample.xml
Type: text/xml
Size: 150 bytes
Desc: sample.xml
Url : http://www.jdom.org/pipermail/jdom-interest/attachments/20060503/3c2e7873/sample.xml
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SAXTester.java
Type: application/octet-stream
Size: 498 bytes
Desc: SAXTester.java
Url : http://www.jdom.org/pipermail/jdom-interest/attachments/20060503/3c2e7873/SAXTester.obj

More information about the jdom-interest mailing list