gpt4 book ai didi

.net - 指定 xs :decimal in an XML schema 的小数位数

转载 作者:行者123 更新时间:2023-12-04 12:38:24 24 4
gpt4 key购买 nike

  • 有没有办法指定 xs:decimal 的小数位数应该在 XML 模式中吗?
  • 有什么办法可以使用 .NET 的 Xml*** 来控制它吗?属性?
  • 最佳答案

    您可以创建扩展十进制的自定义类型并在 fractionDigits 中指定位数。像这样:

    <xs:simpleType name="twoPlacesDecimal" id="twoPlacesDecimal">
    <xs:restriction base="xs:decimal">
    <xs:fractionDigits fixed="true" value="2" />
    </xs:restriction>
    </xs:simpleType>

    您可以使用 XmlAttribute(DataType = "value") 为属性指定数据类型。但不幸的是,这只支持内置数据类型。根据我对源代码的阅读,如果您包含自定义数据类型,则会出现异常。

    关于.net - 指定 xs :decimal in an XML schema 的小数位数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5873038/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com