[xsd-users] Tree-Mapping and xsd:decimal several problems

Forstner Michael Michael.Forstner at cpg.de
Wed Sep 19 02:52:28 EDT 2007


Hi all,

I try to parse and serialize financial XML-Documents as specified by ISO20022:
http://www.iso20022.org/index.cfm?item_id=60051

I've successfully generated a header and a source (cxx-tree) and it seems to work like a charm
but following field is problematic:

<xs:simpleType name="CurrencyAndAmount_SimpleType">
  <xs:restriction base="xs:decimal">
    <xs:minInclusive value="0"/>
    <xs:fractionDigits value="2"/>
    <xs:totalDigits value="18"/>
  </xs:restriction>
</xs:simpleType>

<xs:simpleType name="CurrencyCode">
  <xs:restriction base="xs:string">
    <xs:pattern value="[A-Z]{3,3}"/>
  </xs:restriction>
</xs:simpleType>

<xs:complexType name="CurrencyAndAmount">
  <xs:simpleContent>
    <xs:extension base="CurrencyAndAmount_SimpleType">
      <xs:attribute name="Ccy" type="CurrencyCode" use="required"/>
    </xs:extension>
  </xs:simpleContent>
</xs:complexType>

After parsing a XML-File with following content in a CurrencyAndAmount field,
the internal double-value of the generated cxx-tree-class is still uninitialized:

<TtlIntrBkSttlmAmt Ccy="EUR">288.35</TtlIntrBkSttlmAmt>

After serializing to a XML-File, the decimal point is ',' instead of '.' and
the setting 'fractionDigits value="2"' is ignored:

<sw8:TtlIntrBkSttlmAmt Ccy="EUR">278,35000000000002</sw8:TtlIntrBkSttlmAmt>

I am using XSD 3.0 and tried both Xerces-C 2.7 and 2.8.

Thanks for any help,
Michael Forstner




More information about the xsd-users mailing list