473,503 Members | 3,085 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2400
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
1688
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
9440
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
2479
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
2315
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
7280
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
2428
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
1539
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
3014
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
4936
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
4465
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
7207
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
7012
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7468
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3171
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
402
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.