472,958 Members | 2,086 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

Schema validation problem

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

Jan 18 '06 #1
12 2376
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/#de...ok-restriction

Hope that helps,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Jan 18 '06 #2
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

Jan 18 '06 #3
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)

Jan 18 '06 #4
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
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

Jan 18 '06 #5
steve_marjoribanks writes:
<!--============= 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
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Jan 18 '06 #6
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

Jan 18 '06 #7
steve_marjoribanks writes:
<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
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Jan 19 '06 #8
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?

Jan 20 '06 #9
Here are a few web-based options:

http://apps.gotdotnet.com/xmltools/xsdvalidator/
http://www.w3.org/2001/03/webdata/xsv

--
Stan Kitsis
Program Manager, XML Technologies
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.

"steve_marjoribanks" <st****************@hotmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
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?

Jan 20 '06 #10
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

Jan 21 '06 #11
steve_marjoribanks writes:
So basically, what other ways are there of validating a schema
locally please? Thanks


XSV, Xerces and SQC are all available for download and local use --
see the W3C XML Schema home page [1] for a long list. . .

ht

[1] http://www.w3.org/XML/Schema.html
--
Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
Half-time member of W3C Team
2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
Fax: (44) 131 650-4587, e-mail: ht@inf.ed.ac.uk
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
Jan 23 '06 #12
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?

Jan 25 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: motoman | last post by:
i have the following code (see below), i run my validation and get unexpected results. Public ID: null System ID: file:///C:/DATA/Sandpit/Eclipse/workspace/dtdValidation/memory.xml Line number:...
2
by: Shone | last post by:
I would like to perform a 2-pass XML reading from a stream. Once using the Validating reader, just to confirm the validity against the schema, and next time to do a reading to extract the data....
4
by: Iain A. Mcleod | last post by:
Hi I'm stuck with the following schema validation problem in VS.NET 2003: I have two types of xml document and related schema: project and projectCollection. A projectcollection is just a set...
1
by: Dan Bass | last post by:
There's an XML message I have, that has no namespace information. Then there is a XSD schema that is must validate against, but this has a targetNamespace and xmlns of...
2
by: Ali | last post by:
I am having problem compiling schema contained in WSDL file when analyzing schema types contained in it (for example http://www.ebout.net/net/GoogleSearch.wsdl). Following code demonstrates my...
1
by: Kenny Ho | last post by:
Hi, I have written the following schema that contains the XML signature: ----------------------------------------------------------------------- <?xml version="1.0" encoding="utf-8" ?>...
3
by: jhowey | last post by:
Hi, I would like my default ValidationType to be Auto. Now let's say I have both a DTD and an XSD file for this XML file being validated. While it's ValidationType.Auto, it will validate the...
2
by: Mark | last post by:
Hi... I've been trying the .Validate() method on the XmlDocument to validate some xml against a schema, but one thing I noted was that unless the document explicitly declares the schema as a...
5
by: paul_zaoldyeck | last post by:
does anyone know how to validate an xml file against multiple defined schema? can you show me some examples? i'm making here an xml reader.. thank you
3
by: JMD | last post by:
A set of xsd files has been working fine for us at this site, but now it gives *intermittent* errors for someone at a different cite (who is consuming the code we are producing). Most of the time...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.