FW: [jdom-interest] & in namespace
Aniruddha.Deshpande at softwareag.com
Wed May 3 00:36:43 PDT 2006
Yes, I agree with Elliotte's suspect that namespace URI must actually contain "&" and not "&". The author of the WSDL document that I have might have intended the same. However such URI's (URI with query in it) cannot be entered "as is" in an XML document, they need to be escaped (I think this what Elliotte meant when he said "escaped in XML context").
This is exactly the problem that I am facing. I get a WSDL file by user (which is an XML file and hence has "&" and not "&" in namespace URI). I also agree to your comment that namespace URI's should not have ampersands.
Did you get my point? What did you mean when you said: " Please re-read Elliotte's response: it was 100% accurate.". Did I miss out something?
I tried same with Xerces's XMLSerializer and it works fine.
What do you feel? Is this a bug in JDOM? How should we proceed?
From: jdom-interest-bounces at jdom.org [mailto:jdom-interest-bounces at jdom.org] On Behalf Of Tatu Saloranta
Sent: Wednesday, May 03, 2006 11:42 AM
To: jdom-interest at jdom.org
Subject: Re: FW: [jdom-interest] & in namespace
Please re-read Elliotte's response: it was 100%
accurate. It is possible that JDom's serializer
(outputter) does not quote values of namespace URIs,
and if so, it could and should be fixed.
I would also comment that using namespace URIs with
ampersands is a bad idea.
-+ Tatu +-
--- "Deshpande, Aniruddha"
<Aniruddha.Deshpande at softwareag.com> wrote:
> 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
> 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!
> > <?xml version="1.0" encoding="UTF-8"?>
> <name xmlns:a="http://abc.com?a=b&b=c"
> first="http://abc.com?a=b&b=c">Aniruddha &
> To control your jdom-interest membership:
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
To control your jdom-interest membership:
More information about the jdom-interest