Handle XML from ECB

0
Hi, On http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml you find an XML file with the currency exchange rates of the ECB. I cannot get this imported in my application. I found one XSD generator that creates the right schema (many others did not) and when imported in the model it generates the right datamodel. But not all data it imported. Is this caused by naming multiple levels in the structure Cube? Can you get this to work with pure Mendix or is Java needed? Regards, Paul
asked
3 answers
0

No you don't need java for this, but the xml format is ill defined. Could you show us your current xsd?

answered
0

Just googling around, found xsd

<?xml version="1.0"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Cube">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" name="Cube">
          <xs:complexType>
            <xs:sequence>
              <xs:element minOccurs="0" maxOccurs="unbounded" name="Cube">
                <xs:complexType>
                  <xs:attribute name="currency" type="xs:string" use="optional" />
                  <xs:attribute name="rate" type="xs:decimal" use="optional" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="time" type="xs:date" use="optional" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
answered
0

The XSD that I got from an online generator is (and I manually made some adjustments to let Mendix import the file):

<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.ecb.int/vocabulary/2002-08-01/eurofxref" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Envelope">
    <xs:complexType>
      <xs:sequence>
        <xs:element type="xs:string" name="subject"/>
        <xs:element name="Sender">
          <xs:complexType>
            <xs:sequence>
              <xs:element type="xs:string" name="name"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="Cube1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Cube2">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="Cube3" maxOccurs="unbounded" minOccurs="0">
                      <xs:complexType>
                        <xs:simpleContent>
                          <xs:extension base="xs:string">
                            <xs:attribute type="xs:string" name="currency" use="optional"/>
                            <xs:attribute type="xs:float" name="rate" use="optional"/>
                          </xs:extension>
                        </xs:simpleContent>
                      </xs:complexType>
                    </xs:element>
                  </xs:sequence>
                  <xs:attribute type="xs:date" name="time"/>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
answered