XML/XSD ID/IDREF类型的值的典型最大长度是多少? [英] What is the typical maximum length of values of the XML/XSD ID/IDREF types?

查看:185
本文介绍了XML/XSD ID/IDREF类型的值的典型最大长度是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

W3C XSD 1.0第2部分:数据类型规范是指 W3C XML 1.0 规范,用于ID和IDREF类型的定义,但是这些文档都没有定义对这些类型的值的长度.

The W3C XSD 1.0 Part 2: Datatypes specification refers to the W3C XML 1.0 specification for the definition of the ID and IDREF types, but none of these documents defines any constraints on the length of values of these types.

但是,似乎某些XML编辑器对这些类型实现了长度限制.

However, it seems that some XML editors implement length limitations for these types.

此外,某些网络浏览器似乎实现了长度限制,例如HTML Hx元素的"id"属性(在HTML 4和XHTML 1.1中均定义为XML ID类型)上.

Also, some Web browsers seem to implement length limitations, e.g. on the "id" attribute of the HTML Hx elements (which is defined as XML ID type in both HTML 4 and XHTML 1.1).

  1. 由W3C规范或其他规范定义的ID/IDREF类型的长度是否受到限制?

  1. Are there any constraints on the length of the ID/IDREF types defined by a W3C specification or some other specification ?

XML编辑器实现的典型长度约束是什么?

What are typical length constraints implemented by XML editors ?

Web浏览器(对于HTML)实现的典型长度限制是什么?

What are typical length constraints implemented by Web browsers (for HTML) ?

推荐答案

实际上,很明显,现在存在的每个XML解析器对ID和IDREF类型的值都有长度限制,因为现在存在的每个XML解析器都在一台具有有限存储量的机器(通常,解析器对其准备用于解析文档的存储量的限制要小得多).

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.

我相信某些用户只是简单地下令他们将不使用长度超过32个字符的标识符;我怀疑大多数XML编辑器会接受长度大于一或两个数量级的标识符.

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.

并回答您的第一个问题:在我所知道的任何W3C规范中,对ID/IDREF(或XML规范中的任何其他内容)的长度没有限制.所有实现都必然会有限制,但是据我所知,没有任何规范可以为这些限制设置最低级别,而且我怀疑为这些限制定义设置级别的任何尝试都会立即遭到反对. (XSD 1.1确实为支持某些无限数据类型设置了最小限制,但没有提及ID和IDREF的最小长度限制;严格来说,这些类型的值和词法空间始终是有限的,因此,第5.4节的重点可能是无限的数据类型使它们看起来超出范围.)

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.)

这篇关于XML/XSD ID/IDREF类型的值的典型最大长度是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆