foreign complexType from imported schema raises error in xml instance



I get this error



cvc-complex-type.2.4.a: Invalid content was found starting with element 'Item'. One of '{"http://ift.tt/1wkZM9c":Item}' is expected.



The xml instance I'm using is this:



<?xml version="1.0" encoding="UTF-8"?>
<Foo xmlns="http://ift.tt/1zimHya">
<Element>some Data</Element>
<Element>some Data</Element>
<Element>some Data</Element>
<Bar xmlns="http://ift.tt/1wkZM9g">
<Item>
<Value>My Value</Value>
</Item>
</Bar>
<Element>some Data</Element>
<Element>some Data</Element>
<Element>some Data</Element>
</Foo>


This is the Bar schema:



<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://ift.tt/tphNwY"
xmlns:fooBar='http://ift.tt/1wkZM9c' targetNamespace="http://ift.tt/1wkZM9g"
xmlns:Bar="http://ift.tt/1wkZM9g" elementFormDefault='qualified'>
<import namespace='http://ift.tt/1wkZM9c' />
<element name="Bar">
<complexType>
<sequence>
<element name="Item" type="fooBar:itemType" />
</sequence>
</complexType>
</element>
</schema>


And this is the imported fooBar schema:



<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://ift.tt/tphNwY"
targetNamespace="http://ift.tt/1wkZM9c" xmlns:fooBar="http://ift.tt/1wkZM9c"
elementFormDefault='qualified'>
<complexType name="itemType">
<sequence>
<element name="Value" type="string" />
</sequence>
</complexType>
</schema>


I suppose it is not getting the namespace right? But why? If I drag the itemType from the fooBar schema to the Bar schema the error is the same but this time it complains about the Value element. Is this a bug or am I doing something wrong? It seems it can't handle types from imported schemes.


No comments:

Post a Comment