We have a request to implement our response to a web service, so that the numbers xsd: decimal will be zero if it is not so long when it points to a pattern. I am wondering if this is a reasonable request, and if xsd: decimal is supposed to be used with such patterns. Here is the relevant part of xsd according to their specifications:
<xsd:simpleType> <xsd:restriction base="xsd:decimal"> <xsd:totalDigits value="14"/> <xsd:fractionDigits value="2"/> <xsd:pattern value="[\-+]?[0-9]{1,12}[.][0-9]{2}"/> </xsd:restriction> </xsd:simpleType>
Thus, the Digits fraction is set to 2, which means that the accuracy can be no more than two digits. According to http://zvon.org/xxl/XMLSchemaTutorial/Output/ser_types_st2.html , it is also fine if there are lower digits (for example, for a number like 5.1)
But according to the pattern {2} there should always be 2 digits of shares.
We are developing a common application development platform and do not know what will use the decimal place in advance (currency, pH values, distances, etc.). This case comes from a specific project in which our platform is used, but usually we will not know what data is transmitted. We could decide to simply follow the WSDL in this regard, which claims to have 2 digits of digits. but our implementation should be very general.
It is not said that it is these numbers of digits that should be supplemented, or even that we should use instead of just leaving this decimal integer. Theoretically, we could select a pad with 5 until it matches the pattern. As far as I know, models are rarely used, and if they are used for things like passwords. The XSD specification is vague, so it would be useful if someone could shed some light on whether it is really using XSD, and if it makes sense for us to decide what needs to be imposed on 0.
source share