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-namespaces-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]
>

Reply via email to