aspose file tools*
The moose likes Web Services and the fly likes When the default namespace is an empty string? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "When the default namespace is an empty string?" Watch "When the default namespace is an empty string?" New topic
Author

When the default namespace is an empty string?

Luke Murphy
Ranch Hand

Joined: May 12, 2010
Posts: 300
Hi,
Just wondering what it means exactly when the default namespace is empty?

For example, consider this SOAP fault?



What exactly is the significance of xmlns=""?

Is it needed?
In what situations would you use it?

Thanks.
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1179
XML namespace says under the Namespace undeclaration section -

When an element carries the attribute xmlns="", the default namespace for that element and its descendants reverts to "no namespace": that is, unprefixed names are considered not to be in any namespace.


It's interesting because it means that the faultcode and the faultstring elements are considered not to be in any namespace.

If we look at the Schema defined in the SOAP Version 1.2 Part 1 specification, these elements do belong to the http://www.w3.org/2003/05/soap-envelope namespace.

Regards,
Dan


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Would it be fair to say, then, that whatever software produced that element was in error?
Luke Murphy
Ranch Hand

Joined: May 12, 2010
Posts: 300
Dan Drillich wrote:XML namespace says under the Namespace undeclaration section -

When an element carries the attribute xmlns="", the default namespace for that element and its descendants reverts to "no namespace": that is, unprefixed names are considered not to be in any namespace.


It's interesting because it means that the faultcode and the faultstring elements are considered not to be in any namespace.

If we look at the Schema defined in the SOAP Version 1.2 Part 1 specification, these elements do belong to the http://www.w3.org/2003/05/soap-envelope namespace.

Regards,
Dan


Note totally with you Dan. If we look at Schema defined in the SOAP Version 1.2 Part 1 specification.

We see:



and



If faultcode is not part of the namespace, body isn't either?

What is part of the same namespace then?

can you enlighten?

Thanks.
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1179
Luke Murphy wrote:
If faultcode is not part of the namespace, body isn't either?


As Paul noted, there seems to be a subtle error in the segment you provided; meaning, faultcode should be part of the namespace.

Regards,
Dan

Luke Murphy
Ranch Hand

Joined: May 12, 2010
Posts: 300
Dan Drillich wrote:
Luke Murphy wrote:
If faultcode is not part of the namespace, body isn't either?


As Paul noted, there seems to be a subtle error in the segment you provided; meaning, faultcode should be part of the namespace.

Regards,
Dan



I got the example from the basic profile examples here

Go to:

3.3.3 SOAP Fault Namespace Qualification

The children of the soap:Fault element are local to that element, therefore namespace qualification is unnecessary.

R1001 When an ENVELOPE is a Fault, the element children of the soap:Fault element MUST be unqualified. [/code]

and you'll see


CORRECT:

<soap:Fault xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'
xmlns='' >
<faultcode>soap:Client</faultcode>
<faultstring>Invalid message format</faultstring>
<faultactor>http://example.org/someactor</faultactor>
<detail>
<m:msg xmlns:m='http://example.org/faults/exceptions'>
There were lots of elements in the message that
I did not understand
</m:msg>
</detail>
</soap:Fault>

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: When the default namespace is an empty string?