XML Schema / Validation: Different delimiter for double data type

I changed the data type of some parameters in my xsd file from a string to my real type, in this case double. now I am faced with the problem that here the comma is used as a separator, and not the dot defined by w3 ( http://www.w3.org/TR/xmlschema-2/#double ) causing erros during deserialization (C #, VS2008 )

my question is: can I use the w3 scheme to check, but with a different delimiter for double values?

thanks for your help

+4
source share
1 answer

You cannot do this if you want to continue using simple XML Schema types. decimal and types derived from it are blocked until the period is used. As you say: the specification is 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 this, be careful; XML is a data storage format, not a presentation format. You might want to think about whether you sort it after loading or during XSLT conversion, etc.

+9
source

Source: https://habr.com/ru/post/1300873/


All Articles