Guest TJaze Posted August 11, 2009 Share Posted August 11, 2009 I have just started learning about schemas, and though I'm familiar with namespaces (being a programmer), I'm still a little unclear on how they are used in XML & schemas.Are these just a named reference used to identify a namespace, or do the URL addresses (often used in identifying namespaces), actually contain information that is referenced by the XML or schema file? Link to comment Share on other sites More sharing options...
Ingolme Posted August 23, 2009 Share Posted August 23, 2009 The URI of a namespace doesn't provide any information, it is just used as an identifier.The namespace just allows two elements of the same name, with different meanings, to be in the same document. Link to comment Share on other sites More sharing options...
boen_robot Posted August 23, 2009 Share Posted August 23, 2009 ... or as you said it yourself, it's just a named reference used to identify a namespaceKeep in mind that unlike languages like PHP, C and C#, namespaces in XML are not inhereted. Each URI is treated literaly, without any processing, and is therefore considered as the full namespace. That is, in<a xmlns="http://example.com"><b/><c xmlns="/ns"/></a> The <a/> and <b/> elements are in the "http://example.com" namespace, and the <c/> element is in the "/ns" namespace (NOT in the http://example.com/ns" namespace). In fact, to avoid such kind of confusion, recent editions of the XML namespaces specification deprecated relative URIs, and implementations are therefore encouraged to give warnings if you use such URIs. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.