XML-schema/validation: different separator for datatype double

前端 未结 1 1643
刺人心
刺人心 2020-12-10 20:09

I changed the datatype of some parameters within my xsd file from string to their real type, in this case double. now I\'m facing the problem that around here the comma is u

相关标签:
1条回答
  • 2020-12-10 21:06

    You cannot do that if you want to continue to use the XML Schema simple types. decimal and the types derived from it are locked down to using a period. As you say: the spec here.

    If you want to use a comma as a separator, you need to define your own simple type, for example:

    <xs:simpleType name="MyDecimal">
      <xs:restriction base="xs:string">
        <xs:pattern value="\d+(,\d+)?"/>
      </xs:restriction>
    </xs:simpleType>
    

    Before you do that, though, be careful; XML is a data storage format, not a presentation format. You might want to think about whether you sort this out after loading or during XSLT transformation, etc.

    0 讨论(0)
提交回复
热议问题