What is the max number of characters allowed in an XML attribute?

G33kKahuna picture G33kKahuna · Aug 26, 2009 · Viewed 28.1k times · Source

Is there a standard for the maximum number of characters allowed in an XML attribute?

I tried researching W3C consortium and couldn't find anything on the character limit aside from some notes on escaping special characters.

Answer

Justin Niessner picture Justin Niessner · Aug 26, 2009

I don't believe there is a character limit per the XML specification, but the Best Practice is to keep attribute values short.

If an attribute value grows long...chances are that it should be an element of its own rather than an attribute on another element.