Hi Dan,

I appreciate the reasoning, and the requirement (I fought alot with Axis
1.4 to get proper namespace handling) to use explicit prefixes.  

As I'd been in "customise it" mode I'd not even thought to look in the
troubleshooting :<  I'd be tempted to make it throw a RuntimeException
though since it is something that causes such problems.

cheers,
chris

-----Original Message-----
From: Daniel Jemiolo [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 10, 2007 6:46 PM
To: [email protected]
Subject: Re: QName bug : XmlUtils - getAllNamespaces


Hi,

Default namespaces and empty prefixes have been a sore spot for a long
time
- Xerces/Axis 1/Axis2 have not provided consistent behavior in this
area, and we've covered the issues in this troubleshooting entry:


http://ws.apache.org/muse/docs/2.2.0/manual/troubleshooting/default-name
spaces-xerces.html

The problem with your sample is that it mixes the concepts of default
namespaces with empty prefixes. When an element has a default namepace
(xmlns="..."), there is no prefix, so the QName is just the local name
and URI; when it has an empty prefix (xmlns:="..."), the element has a
complete QName. We've chosen to avoid default namespace support because
the two things are so often confused and lead to interop problems
between stacks.

Dan


Dan Jemiolo
IBM Corporation
Research Triangle Park, NC


+++ I'm an engineer. I make slides that people can't read. Sometimes I 
+++ eat
donuts. +++



<[EMAIL PROTECTED]> wrote on 08/01/2007 02:58:25 PM:

> Hi All,
>
> getAllNamespaces builds a map of prefix declarations to namespaces.
> However it doesn't account for xml like this:
>
>    <wsnt:Message>
>       <wsrf-rp:ResourcePropertyValueChangeNotification
> xmlns:wsrf-rp="http://docs.oasis-open.org/wsrf/rp-2";>
>          <wsrf-rp:OldValues>
>             <muws2:State
> xmlns:muws2="http://docs.oasis-open.org/wsdm/muws2-2.xsd";>
>                <Running
> xmlns="http://swisscom.com/sif/esb/management/runtimeInfo"/>
>             </muws2:State>
>          </wsrf-rp:OldValues>
>          <wsrf-rp:NewValues>
>             <muws2:State
> xmlns:muws2="http://docs.oasis-open.org/wsdm/muws2-2.xsd";>
>                <ShuttingDown
> xmlns="http://swisscom.com/sif/esb/management/runtimeInfo"/>
>             </muws2:State>
>          </wsrf-rp:NewValues>
>       </wsrf-rp:ResourcePropertyValueChangeNotification>
>    </wsnt:Message>
>
> where the states are set with the default namespace.  This causes 
> problems with serialization since according to the spec:
>
>    If not specified, the Namespace URI is set to "" (the empty
> string). If not specified, the prefix is set to "" (the    empty
> string).
>
> as such the NotificationMessage has
> xmlns:="http://swisscom.com/sif/esb/management/runtimeInfo"; added as 
> an attribute, which is clearly invalid xml.
>
> I would propose changing the put to:
>
> if (prefix.length() > 0) {
>    namespacesByPrefix.put(prefix, namespace); }
>
> If this makes sense I can raise a jira issue. For the time being I'll 
> change my qnames to include prefixes.
>
> cheers,
> Chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to