This is my xml (not whole):
<xsd:complexType name="xx">
<xsd:complexContent>
<xsd:extension base="tns:xx">
<xsd:sequence>
<xsd:element name="rekVrednostDdv" nillable="true" type="decimal"/>
<xsd:element name="xx" nillable="true" type="dateTime"/>
<xsd:element name="xx" nillable="true" type="decimal"/>
<xsd:element name="xx" nillable="true" type="string"/>
<xsd:element name="xx" nillable="true" type="dateTime"/>
<xsd:element name="xx" nillable="true" type="string"/>
<xsd:element name="xx" nillable="true" type="decimal"/>
<xsd:element name="xx" nillable="true" type="decimal"/>
<xsd:element name="xx" nillable="true" type="string"/>
<xsd:element name="xx" nillable="true" type="string"/>
<xsd:element name="xx" nillable="true" type="decimal"/>
<xsd:element name="xx" nillable="true" type="tns:xx"/>
<xsd:element name="xx" nillable="true" type="dateTime"/>
<xsd:element name="xx" nillable="true" type="string"/>
<xsd:element name="xx" nillable="true" type="string"/>
<xsd:element name="xx" nillable="true" type="string"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
For example rekVrednostDdv must have precision 2. How can i tell this type to have precision 2.
i try like this:
<xsd:element name="rekVrednostDdv" nillable="true">
<xsd:simpleType>
<xsd:restriction base="decimal">
<xsd:precision value="6"/>
<xsd:scale value="2"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
but now i get when using http://www.brainbell.com/tutorials/XML/Working_With_Simple_Types.htm
Invalid XML schema: 'Element <xsd:precision> is not allowed under element <xsd:restriction>.'
Description. xs:decimal is the datatype that represents the set of all the decimal numbers with arbitrary lengths. Its lexical space allows any number of insignificant leading and trailing zeros (after the decimal point).
Description. The value space of xs:float is “float” (32 bits) floating-point numbers as defined by the IEEE. The lexical space uses a decimal format with optional scientific notation. The match between lexical (powers of 10) and value (powers of 2) spaces is approximate and is done on the closest value.
The difference is the following: xs:int is a signed 32-bit integer. xs:integer is an integer unbounded value.
You can specify the default value of an XML element or XML attribute by applying a DefaultValueAttribute to a member. To examine the result of applying the value, compile the application into a DLL or executable, and pass the resulting file as an argument to the XML Schema Definition tool (XSD.exe).
Create a new simple type that restricts xs:decimal
and use <xs:fractionDigits/>
to define the precision. Then refer to this type in your element definition.
<xs:simpleType name="decimalTwoPrec">
<xs:restriction base="xs:decimal">
<xs:fractionDigits value="2" />
</xs:restriction>
</xs:simpleType>
<xs:element name="rekVrednostDdv" nillable="true" type="decimalTwoPrec"/>
For more info, see the spec http://www.w3.org/TR/xmlschema-2/#rf-fractionDigits
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With