Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Confusion in namespace  RSS feed

 
Mike Thomson
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know the meaning of targetnameSpace. Suppose I have used the following elements in the XML

<employee>
Raj
</employee>

Now the XML parser will know the above element is belong to the targetnameSpace.



But what my doubt is what is the meaning of urn:fibonacci in the above xml? Which thing this points to? Whether it's just like a package name and we can give anything we want?
for example: In the below the namespace xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" if I use like: <wsdlsoap:example>blah..</wsdlsoap:example>, then the meaning is the example should be an element of wsdlsoap.
Here my doubt is it's pointing to an url, but I have not connected to an internet, then how it will know what are the elements available in wsdlsoap.
What actually the below lines means? Whether any resources will be there in the follwoing url?
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"

I have clicked the above url and a page opened and seems to be an ordinary page. Whether the namespace should be always point to an url?



Why should we use the above two namespaces?. whether the following targetnampSpace is not enough?

 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mike Thomson:
I know the meaning of targetnameSpace.


Well - according to your description you do not.

  • absolute URIs act as namespace identifiers only. There is no requirement that the URI is in fact a valid address. It can be but it doesn't have to be. For the purposes of validation you will have to provide an address at which the schema can be found separately (schemaLocation). In many cases you would actually provide the parser the schema locations separately from the document that references the schema.
  • targetNamespace simply identifies the namespace into which any new types and elements are defined. To access these new elements and types you still need a separate namespace declaration.


  • See:namespace and targetnamespace

    Ronald Bourret's XML Namespaces FAQ
    James Clark: XML Namespaces
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!