Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

When the default namespace is an empty string?  RSS feed

 
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 23963
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would it be fair to say, then, that whatever software produced that element was in error?
 
Luke Murphy
Ranch Hand
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 300
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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>

 
Run away! Run away! Here, take this tiny ad with you:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!