• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

TargetNameSpace?

 
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am going thru the XML Schema specs- I had some basic doubts about TargetNameSpace:
1. TargetNameSpace(TNS) is supposed to provide uniqueness- isn't namespace already providing it. What additional benefits does TNS offer.
2. Does one Schema have only one TargetNameSpace or it can have more? Also if a Schema has more than one NameSpace TargetNameSpace applies to which NameSpace.
TIA
Sanjay
 
author
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

1. TargetNameSpace(TNS) is supposed to provide uniqueness- isn't namespace already providing it. What additional benefits does TNS offer?


The question makes it sound like "targetNamespace" is a rival namespacing mechanism. This isn't what it is at all.
"targetNamespace" is used in a schema to specify the namespace that the schema is intended to define.
For example the XHTML schema specifies a targetNamespace of "http://www.w3.org/1999/xhtml". The schema defines the structure and content of an XHTML document.
If you create an XHTML document you specify the namespace "http://www.w3.org/1999/xhtml" to indicate that its an XHTML document.
Upon receiving XML that uses the namespace "http://www.w3.org/1999/xhtml", a validating parser could look for the schema with this URI as its targetNamespace and then use the schema to validate the XML it's receiving.

2. Does one Schema have only one TargetNameSpace or it can have more? Also if a Schema has more than one NameSpace TargetNameSpace applies to which NameSpace.


A schema only has one targetNamespace.
David
 
Tiger Scott
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
David,
Thanks.
Please bear with me- it is still confusing for me.


A schema only has one targetNamespace.
"targetNamespace" is used in a schema to specify the namespace that the schema is intended to define.


So is it that "targetNamespace" is used only in Schema documents. I see some example XML documents with "targetNamespace" ?



For example the XHTML schema specifies a targetNamespace of "http://www.w3.org/1999/xhtml". The schema defines the structure and content of an XHTML document.
If you create an XHTML document you specify the namespace "http://www.w3.org/1999/xhtml" to indicate that its an XHTML document.
Upon receiving XML that uses the namespace "http://www.w3.org/1999/xhtml", a validating parser could look for the schema with this URI as its targetNamespace and then use the schema to validate the XML it's receiving.


So my XML document would link to the "targetNamespace" with the namespace declaration in my XML document. And the linking is based on the URI being the same? Do the URI of "targetNamespace" and namsespace have to be the same?
I think my confusion emanates from my lack of understanding of namespace itself.
TIA
Sanjay


[This message has been edited by Sanjay Bahal (edited November 27, 2001).]
 
David Peterson
author
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I think my confusion emanates from my lack of understanding of namespace itself.


Take a look at this
Microsoft XML Tutorial
It might help clarify things with regard to namespaces.


So is it that "targetNamespace" is used only in Schema documents. I see some example XML documents with "targetNamespace" ?


"targetNamespace" is generally used in schemas, and schema-like things, e.g. Web Services Description Language (WSDL).
David
 
Tiger Scott
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
David,
Thanks.
So if I finally undersatnd it right- NameSpace has nothing to do with DTD or validation- it is just to make a name unique?
DTDs if reqd would be included in the XML document by the DOCTYPE declaration?
TIA
Sanjay
 
reply
    Bookmark Topic Watch Topic
  • New Topic