What is the typical maximum length of values of the XML/XSD ID/IDREF types?

狂风中的少年 提交于 2019-12-06 05:09:38

Actually, it's pretty clear that every XML parser now in existence has a length limitation on values of type ID and IDREF, because every XML parser now in existence runs on a machine with a finite amount of storage (and usually the parser has a much smaller limit on the amount of storage it is prepared to use in parsing documents).

The only pattern I'm aware of (based on my limited experience) is that it's not unusual for the effective limit to be given not by a predefined quantity but by the amount of memory available at the crucial instant at run time.

I believe some users simply decree that they will not use identifiers longer than 32 characters; I suspect most XML editors will accept identifiers whose length is one or two orders of magnitude greater.

And to answer your first question: there are no constraints on the length of ID/IDREF (or anything else in the XML spec) defined in any W3C spec that I am aware of. All implementations will necessarily have limits, but there is no spec that I know of that sets a minimum level for those limits, and I suspect that any attempt to define a set level for those limits would be shot down immediately in a barrage of scorn. (XSD 1.1 does set minimum limits for the support of some infinite datatypes, but says nothing about minimum length limits for ID and IDREF; strictly speaking the value and lexical spaces of those types are always finite, so perhaps the focus of section 5.4 on infinite datatypes made them seem out of scope.)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!