Schema validation problem

steve_marjoribanks

Usenet Archive
Joined
Nov 28, 2005
Messages
91
Reaction score
0
I'm fairly new to XML and schemas and I'm trying to work out why a schema I've been given keeps throwing up validation errors in XMLSpy. The section of code with the problem is:

<!--============= Element =============-->
<element name="conResults" type="agsml:CongArrayType"
substitutionGroup="agsml:_congProperty"/>
<!--============= ComplexType =============-->
<complexType name="CongArrayType">
<complexContent>
<restriction base="gml:FeatureArrayPropertyType">
<sequence>
<element ref="agsml:_CongFeature" maxOccurs="unbounded"/> </sequence> </restriction> </complexContent> </complexType>

Whenever I try to validate it, XMLSpy highlights the <complexType name="CongArrayType"> tag and says:
"The content model of complexType "agsml:CongArrayType" is not a valid restriction of the content model of complexType "gml:FeatureArrayPropertyType"

Presumably this means that there is an error elsewhere in the schema in the part which defines gml:FeatureArrayPropertyType? Is this correct or is there an obvious error in the above code which I have missed? I can't really post the whole schema because it's a collection of 7 schemas which are hundreds of lines long!

Thanks
Stephen
 

GeorgeBina

Usenet Archive
Joined
Jan 18, 2006
Messages
3
Reaction score
0
Hi Stephen,

The error message refers to the fact that you cannot restrict the gml:FeatureArrayPropertyType with something like you wrote in your schema, that is with a content model like:
<sequence>
<element ref="agsml:_CongFeature" maxOccurs="unbounded"/> </sequence> This does not mean that the gml:FeatureArrayPropertyType has errors, the error is in the defined CongArrayType. You may look also in the spec where what a valid derivation by restriction is specified:
http://www.w3.org/TR/xmlschema-1/#derivation-ok-restriction

Hope that helps,
George
 

steve_marjoribanks

Usenet Archive
Joined
Nov 28, 2005
Messages
91
Reaction score
0
Thanks for the info!
The problem is that I didn't write the schema and so I'm trying to work out what they intended. I think I understand what you said above but the one problem with it is that there are numerous other elements and complex types declared of exactly the same format as the one above, such as:

<!--============= Element =============-->
<element name="laboratoryTesting" type="agsml:SampArrayType" substitutionGroup="agsml:_sampProperty"/> <!--============= ComplexType =============--> <complexType name="SampArrayType"> <complexContent> <restriction base="gml:FeatureArrayPropertyType"> <sequence> <element ref="agsml:_SampFeature" maxOccurs="unbounded"/> </sequence> </restriction> </complexContent> </complexType>

and none of these seem to throw up errors even though there are a fCongArrayType isn't even though they both are of exactly the same format and content (just with different names, types and refs)?

Thanks
Stephen
 

steve_marjoribanks

Usenet Archive
Joined
Nov 28, 2005
Messages
91
Reaction score
0
Sorry the last paragraph got messed up for some reason. It was supposed to say;

and none of these seem to throw up errors even though they are of a very similar layout/format to the CongArrayType complexType (ie. different name and type, same restriction, one element in a sequence, different reference element)
 

GeorgeBina

Usenet Archive
Joined
Jan 18, 2006
Messages
3
Reaction score
0
Hi Stephen

Maybe the answer is in the difference between agsml:_CongFeature and agsml:_SampFeature? It is hard to tell what is wrong from these fragments, you may want to check also with different schema processors like XercesJ, XSV, Saxon8, MSXML, etc. to see if you get an error message that can help you more.

Best Regards,
George
 

Henry S. Thompson

Usenet Archive
Joined
Jan 14, 2000
Messages
309
Reaction score
0
steve_marjoribanks said:
<!--============= ComplexType =============-->
<complexType name="CongArrayType">
<complexContent>
<restriction base="gml:FeatureArrayPropertyType">
<sequence>
<element ref="agsml:_CongFeature" maxOccurs="unbounded"/> </sequence> </restriction> </complexContent> </complexType>

Whenever I try to validate it, XMLSpy highlights the <complexType name="CongArrayType"> tag and says:
"The content model of complexType "agsml:CongArrayType" is not a valid restriction of the content model of complexType "gml:FeatureArrayPropertyType"

So we need to see the complex type definition of
FeatureArrayPropertyType in the imported schema document for whatever namespace 'gml' is bound to, before we can identify the problem.

ht
 

steve_marjoribanks

Usenet Archive
Joined
Nov 28, 2005
Messages
91
Reaction score
0
Ok, the gml:FeatureArrayPropertyType is defined as:

<element name="featureMembers" type="gml:FeatureArrayPropertyType"/> <!-- ========================================================== --> <complexType name="FeatureArrayPropertyType"> <annotation> <documentation>Container for features - follow gml:ArrayAssociationType pattern.</documentation> </annotation> <sequence> <element ref="gml:_Feature" minOccurs="0" maxOccurs="unbounded"/> </sequence> </complexType>

the referenced element above is:

<element name="_Feature" type="gml:AbstractFeatureType" abstract="true" substitutionGroup="gml:_GML"/>

and the gml:AbstractFeatureType as mentioned there is defined as:

<complexType name="AbstractFeatureType" abstract="true"> <annotation> <documentation> An abstract feature provides a set of common properties, including id, metaDataProperty, name and description inherited from AbstractGMLType, plus boundedBy. A concrete feature type must derive from this type and specify additional properties in an application schema. A feature must possess an identifying attribute ('id' - 'fid' has been deprecated). </documentation> </annotation> <complexContent> <extension base="gml:AbstractGMLType"> <sequence> <element ref="gml:boundedBy" minOccurs="0"/> <element ref="gml:location" minOccurs="0"> <annotation> <appinfo>deprecated</appinfo> <documentation>deprecated in GML version 3.1</documentation> </annotation> </element> <!-- additional properties must be specified in an application schema --> </sequence> </extension> </complexContent> </complexType>

However, I can see this problem going round in circles because the original schema I was looking at was one of an 11 part schema definition. These schemas in turn include certain GML schemas which reference other schemas in the 33 part schema definition of the GML dialect!!! XMLSpy has now started saying in the error message "The schema doesn't appear to be valid by itself (as part of another schema it might still be ok), *error details here* ". Seeing as it is saying there are validation errors with the GML schemas (GML is now in version 3.1.0), I think it is more likely that the schemas are in fact valid and it is simply a problem of XMLSpy not being able to validate the schemas that are included in other schemas or something like that? Surely it must be able to do this somehow though, or can anyone recommend any other solutions?

Thanks for the help,
Stephen
 

Henry S. Thompson

Usenet Archive
Joined
Jan 14, 2000
Messages
309
Reaction score
0
steve_marjoribanks said:
<restriction base="gml:FeatureArrayPropertyType">
<sequence>
<element ref="agsml:_CongFeature" maxOccurs="unbounded"/> </sequence> </restriction>
Ok, the gml:FeatureArrayPropertyType is defined as:

<element name="featureMembers" type="gml:FeatureArrayPropertyType"/> <!-- ========================================================== --> <complexType name="FeatureArrayPropertyType"> <sequence> <element ref="gml:_Feature" minOccurs="0" maxOccurs="unbounded"/> </sequence> </complexType>

<element name="_Feature" type="gml:AbstractFeatureType" abstract="true" substitutionGroup="gml:_GML"/>

(gee, I love this remote debugging. . .:)

Given the above, what we know need to know is whether or not agsml:_congFeature is substitutable for gml:_Feature, i.e. does the agsml schema have something like

<element name="_congFeature" type="xyzzy"
substitutionGroup="gml:_Feature"/>

where 'xyzzy' is or is derived by restriction from gml:AbstractFeatureType?

If not, your schema is indeed broken. If so, the version of Spy you're using is the likely culprit. Should have asked before now -- have you tried validating with another validator?

ht
 

steve_marjoribanks

Usenet Archive
Joined
Nov 28, 2005
Messages
91
Reaction score
0
The schema does have the above line in it, so I'm guessing I should try with another validator. This is gonna sound really dumb but how do I go about doing this?
 

steve_marjoribanks

Usenet Archive
Joined
Nov 28, 2005
Messages
91
Reaction score
0
Thanks for the links. However, I have found that all of the online validators I've tried don't work in my case. This could be because they don't like working with schemas which import other schemas I'm not sure. However, I think the most likely explanation is that the AGSML schemas I am looking at are not actually in use yet, they are only at the consultation stage and as such are only stored on my local drive not on the webspace which the agsml namespace refers to. I imagine this might be causing some of the problems when validating because the validator is having to import the schemas from a local directory. This shouldn't be a problem when validating locally on my computer because the include schema statement gives the local directory paths. So basically, what other ways are there of validating a schema locally please?
Thanks
 

steve_marjoribanks

Usenet Archive
Joined
Nov 28, 2005
Messages
91
Reaction score
0
I've just discovered that the schema validates fine when XMLSpy is in Schema/WSDL view but comes up with an error if it is in text view?!!!! Presumably this is a bug in XMLSpy then?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,049
Messages
3,104,243
Members
248,133
Latest member
DujonT

Latest Threads

Top