Searchable Namespaces 1: Specification 1.1: Local names may include multiple colons. Fully-qualified names should be in reversed-dns form, separated by colons. Example 1.1.1: ... 1.2: xmlns and xmlns: attributes specify a list of namespaces seperated by spaces. e.g.: Example 1.2.1: ... Example 1.2.2: ... 1.3: Namespaces are hierarchical. Example 1.3.1: ... 1.4: Old-style namespaces may still be used, but because they contain invalid characters, they must be used with an xmlns or xmlns: attribute. Example 1.4.1: ... Example 1.4.2: ... Example 1.4.3: ... 1.5: Children that define a default namespace automatically include their parent's default namespace. The following two examples are identical: Example 1.5.1: ... Example 1.5.2: ... 2: Implementation 2.1: Non-namespace-aware parsers should ignore everything before the *last* colon. This should also be the case for non-namespace-aware languages, such as CSS2. 2.2: Contemporary namespace-aware parsers typically provide the user with three pieces of data for every XML name: the local name, the prefix, and the namespace. 2.2.1: Namespace-aware parsers must first check to see if the first part of the XML name was previously specified in an xmlns: attribute. If so, the first part is saved as the prefix, the remainder is saved as the local name, and the space-separated namespace list specified by the xmlns: attribute is saved as the namespace. For instance, the 'svg' tag in example 1.2.2 would be parsed as such: local: "svg" prefix: "w3" namespace: "org:w3:xhtml5 org:w3:svg12" 2.2.2: If the XML name did not specifiy a prefix, then the entire XML name is saved as the local name, and the default namespace is saved as the namespace. For instance, the 'svg' tag in example 1.5.1 would be parsed as such: local: "svg" prefix: NULL namespace: "org:w3:svg12 org:w3:xhtml5" The 'svg' tag in example 1.3.1 would be parsed as such: local: "svg12:svg" prefix: NULL namespace: "org:w3" An XML file which is valid under the old-style namespace rules should be parsed identically using these new rules. 2.3: A simple function can be written to compare a fully-qualified XML name against the local, prefix, and namespace parts. Example 2.3.1: if(IsEqual("org:w3:svg12:svg", "svg", NULL, "org:w3:svg12 org:w3:xhtml5")) // Do something. (Note: implementations are of course free to store the namespace in a structure that's more efficient than a naive string.) 2.4: A more advanced implementation may want to specify a list of known tags, to allow for conflict resolution. For orthogonal dialects, or dialects that are unambiguous in context, this is unnecessary. This list is only needed by the software that knows what each tag means; any parsing step that happened earlier can blissfully ignore conflicts.