title: Formal or Practical XML Tag Length Limit?
body: <p>I've not managed to find any mention of a limit to xml tag length on the web. I'm looking to build XML Schemas that act as a specification for 3rd parties to send data to us.</p>
  
  <p>The Schema (and the data) are supposed to conform to our custom ontology/data dictionary thingy which is hierarchical and user-customizable.</p>
  
  <p>The natural mapping is for nodes in the hierarchy to be used to name types and tags in the XSD/XML. Because however leaf node names in the ontology do not have to be unique, I am considering encoding the full path of nodes in the hierarchy as the tag name, suitably mangled for XML lexical rules.</p>
  
  <p>So if my ontology has multiple 'lisa' nodes meaning different things as they are at different places in the hierarchy I could use the full path to the nodes to generate different XML types/tag names, so you can have</p>
  
  <pre><code> &lt;abe_homer_lisa&gt; simpsons lisa ... &lt;/abe_homer_lisa&gt;
   &lt;applei_appleii_lisa&gt; ... apple lisa &lt;/applei_appleii_lisa&gt;
   &lt;mona_lisa&gt; and paintings &lt;/mona_lisa&gt;
  </code></pre>
  
  <p>... data for any of the different 'lisa' types in the same file without ambiguity.</p>
  
  <p>I can't find anything on the web that specifies a maximum tag length (or a minimum supported tag length for standards-compliant engines). (Good summary of the lexical rules for XML <a href="http://ooatool.com/ooa/OOATool/ExtensibleMarkupLanguage/ExtensibleMarkupLanguage.pattern.html" rel="nofollow noreferrer">here</a>)</p>
  
  <p>The same thing <a href="https://stackoverflow.com/questions/1334776/how-many-characters-allowed-in-xml-attribute">was asked about attribute length</a> and if the standard specifies no limit for attributes then I doubt there's one for tags, but there may be a practical limit.</p>
  
  <p>I suspect even a practical limit would be vastly bigger than my needs (I would expect things to be smaller than 255 chars most of the time); basically if the Java XML processors, standard ETL tools and the common XSLT processors can all handle tags much bigger than this then it won't be an issue.</p>