Hi Eric,


On 4 Nov 2004, at 17:05, Erik Rydgren wrote:

Thanks for the reply, but unfortunately I have little saying about how the European central bank generates files ;-)

I have total control over the schema declarations but none over the xml data.

 

Anyhow, shouldn’t the target namespace in ecb.xsd take care of forcing all Cube declarations into the ecb namespace?


It does, and thats the problem. In gemes.xsd you specify that elements in an instance document must qualify its elements with elementformdefault="qualified". You then specify that one of your elements in your rootType sequence is ecb:Cube. In your instance document you do not give it a prefix, which is why you get the error. If ecb.xsd had no target namespace this would work (I think).


Does that make it clearer?


Gareth



<?xml version="1.0" encoding="UTF-8"?>
<gesmes:Envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01";
xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://www.gesmes.org/xml/2002-08-01 gesmes.xsd">
                <gesmes:subject>Reference rates</gesmes:subject>
                <gesmes:Sender>
                                 <gesmes:name>European Central Bank</gesmes:name>
                </gesmes:Sender>
                <Cube>
                                 <Cube time='2004-10-27'>
                                                  <Cube currency='USD' rate='1.2792'/>
                                                  <Cube currency='JPY' rate='136.37'/>
                                                  <Cube currency='DKK' rate='7.4348'/>
                                 </Cube>
                </Cube>
</gesmes:Envelope>


There are also two schemas involved. First gesmes.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.gesmes.org/xml/2002-08-01";
xmlns:ecb="http://www.ecb.int/vocabulary/2002-08-01/eurofxref";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01";
elementFormDefault="qualified">
 <xs:import
namespace="http://www.ecb.int/vocabulary/2002-08-01/eurofxref";
schemaLocation="ecb.xsd"/>
 <xs:complexType name="subjectType"/>
 <xs:complexType name="SenderType">
   <xs:sequence>
     <xs:element name="name" type="xs:string"/>
   </xs:sequence>
 </xs:complexType>
 <xs:complexType name="rootType">
   <xs:sequence>
     <xs:element name="subject" type="xs:string"/>
     <xs:element name="Sender" type="gesmes:SenderType"/>
     <xs:element ref="ecb:Cube"/>
   </xs:sequence>
 </xs:complexType>
 <xs:element name="Envelope" type="gesmes:rootType"/>
</xs:schema>

The second schema is ecb.xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
targetNamespace="http://www.ecb.int/vocabulary/2002-08-01/eurofxref";
xmlns:ecb="http://www.ecb.int/vocabulary/2002-08-01/eurofxref";
xmlns:xs="http://www.w3.org/2001/XMLSchema";
elementFormDefault="unqualified">
 <xs:complexType name="CubeType3">
   <xs:attribute name="currency" type="xs:string"/>
   <xs:attribute name="rate" type="xs:decimal"/>
 </xs:complexType>
 <xs:complexType name="CubeType2">
   <xs:sequence>
     <xs:element name="Cube" type="ecb:CubeType3" minOccurs="0"
maxOccurs="unbounded"/>
   </xs:sequence>
   <xs:attribute name="time" type="xs:date"/>
 </xs:complexType>
 <xs:complexType name="CubeType">
   <xs:sequence>
     <xs:element name="Cube" type="ecb:CubeType2" minOccurs="0"
maxOccurs="unbounded"/>
   </xs:sequence>
 </xs:complexType>
 <xs:element name="Cube" type="ecb:CubeType"/>
</xs:schema>

As I said XmlSpy regards the data as valid but Xerces tells me that Cube
is not valid content to envelope. I can't figure out what the problem
is. Any help would be greatly appriciated.


Best regards
Erik Rydgren



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
Gareth Reakes, Managing Director      Parthenon Computing
+44-1865-811184                  http://www.parthcomp.com


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to