Search code examples
xmlvalidationspecificationsnodename

Is <:nodename> a valid xml node name?


I read milions of questions about xml node naming rules. But none of them answer the simple question: Can the node name start with colon?

Example:

<:nodename>Inner text</:nodename>

This can be associated with empty namespace (global namespace). But not sure if this is valid, and what is the possible usage of such a name.

PS. No real application of code, or ideas where to use it, just curiosity and self-learning purposes.

PS 2. Some research links:


Solution

  • It's well-formed according to the XML 1.0 and XML 1.1 specifications, but not according to the namespaces specification. Most people (and software) require XML to be namespace-well-formed, so it would be definitely best to avoid it.