Validation problem csvc-complex-type.2.4.a Invalid content - But element is in the list!
Posted: Mon May 21, 2012 4:25 pm
Hi all,
I'm a firsttimer with writing XSD's and now I've hit a validation error which I cannot seem to resolve. Hope one of you could help me out.
XML I want to validate:
Schema:
I get the following error:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'object_id'. One of '{object_id, description, level}' is expected. which I found odd because object_id is present in the list, why isn't it recognised?
Thanks in advance for any help.
I'm a firsttimer with writing XSD's and now I've hit a validation error which I cannot seem to resolve. Hope one of you could help me out.
XML I want to validate:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<DOStreetLightList xmlns="http://munisense.com/webservices/v1/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://munisense.com/webservices/v1/ muniws.xsd">
<DOStreetLight id="12">
<object_id value="2334">32ef:8903:328df</object_id>
<description error="434" />
<level error="434" />
</DOStreetLight>
<DOStreetLight id="12">
<object_id value="23214">234:234:as23</object_id>
<level error="12" />
</DOStreetLight>
</DOStreetLightList>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:muniws="http://munisense.com/webservices/v1/"
targetNamespace="http://munisense.com/webservices/v1/">
<xs:element name="DOStreetLightList">
<xs:complexType>
<xs:sequence>
<xs:element ref="muniws:DOStreetLight" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="DOStreetLight">
<xs:complexType>
<xs:all>
<xs:element name="object_id" type="muniws:DOProperty" minOccurs="0" />
<xs:element name="description" type="muniws:DOProperty" minOccurs="0" />
<xs:element name="level" type="muniws:DOProperty" minOccurs="0" />
</xs:all>
<xs:attribute name="id" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<xs:complexType name="DOProperty">
<xs:attribute name="error" use="optional" type="xs:string" />
<xs:attribute name="value" use="optional" type="xs:string" />
</xs:complexType>
</xs:schema>
cvc-complex-type.2.4.a: Invalid content was found starting with element 'object_id'. One of '{object_id, description, level}' is expected. which I found odd because object_id is present in the list, why isn't it recognised?
Thanks in advance for any help.