tags:

views:

67

answers:

1

I always wondered how an XML parser handle the check of a URI namespace. is it string based, or URI based? in other words, this is the standard URI for SVG

xmlns="http://www.w3.org/2000/svg"

suppose that I write instead

xmlns="http://www.w3.org/2000/../2000/svg"

or

xmlns="http://www.w3.org/2000/svg/"

or even

xmlns="http://www.w3.org:8000/2000/svg"

Will these cases be recognized as svg namespaces (URI based) or not (string based)?

Thanks

Edit : the fact that you can use URNs (like a uuid) makes me feel like it's string based, because you cannot apply the proper URL/URI considerations to a non URL-like URI. But maybe in that case it will just work as a string ?

Edit: As Tormod points out it is made with a string comparison. This prompts me to wonder if there are recommendations for defining URIs (like: no slash at the end, all lowercase, etc...). Or is it just a free-for-all ?

+5  A: 

They are string based. All your sample URIs resolve to different namespaces.

http://www.w3.org/TR/REC-xml-names/#NSNameComparison

URI references identifying namespaces are compared when determining whether a name belongs to a given namespace, and whether two names belong to the same namespace. [Definition: The two URIs are treated as strings, and they are identical if and only if the strings are identical, that is, if they are the same sequence of characters. ] The comparison is case-sensitive, and no %-escaping is done or undone.

Tormod Fjeldskår