xml - XML 架构 (XSD) 中十进制类型的限制是什么?

标签 xml xsd decimal xsd-validation xml-validation

XML 模式中十进制类型的最小和最大可接受值是多少? (type="xs:decimal")?

最佳答案

XML 模式本身并不对 xsd:decimal 施加最小值和最大值。 :

[Definition:] decimal represents arbitrary precision decimal numbers. The ·value space· of decimal is the set of the values i × 10^-n, where i and n are integers such that n >= 0.

[将此与 xsd:float 进行对比,对应 IEEE 单精度 32 位 float 。]

另一方面,实现可能支持对 xsd:decimal 范围的限制:

NOTE: All ·minimally conforming· processors ·must· support decimal numbers with a minimum of 18 decimal digits (i.e., with a ·totalDigits· of 18). However, ·minimally conforming· processors ·may· set an application-defined limit on the maximum number of decimal digits they are prepared to support, in which case that application-defined maximum number ·must· be clearly documented.

[例如,Xerces2-J uses java.math.BigDecimal;请参阅How to get biggest BigDecimal关于 BigDecimal 可以有多大的答案的值。]

关于xml - XML 架构 (XSD) 中十进制类型的限制是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26909331/

相关文章:

java - XJC - 编译器无法接受此类定制

php - 使用亚马逊 MWS 时我的 Feed 应该是什么样子?

jquery - 使用 JQuery 按值检查 XML 节点是否存在

java - 使用 JSTL 标签转义 XML 来预防 XSS 是否有任何缺点

javascript - JavaScript 中的正则表达式 : Content Between Two Tags

java - java 小数错误,因此计算错误

c# - 正则表达式验证 .NET 的非负小数或空白?

xml - Golang Xml Unmarshal,没有值(value)

java - XSD 中的哪个属性将在 JAXB 生成的类中使用 @XmlElement(required = false) 注释字段

sql - 从 SQL Server 中的十进制中删除尾随零