Loading set of schemas in .NET 2.0

This should cover W3C XML Schema, Relax NG and DTD related problems.
adobra
Posts: 6
Joined: Tue Oct 09, 2007 11:57 am
Location: Perth, Western Australia

Loading set of schemas in .NET 2.0

Post by adobra »

Hi
We are developing an application based on a complex set of schemas. This schema set is based on ISO19139.
It validates in Oxygen. However, when loading the schema set into the application, the application tries to compile the schema set using 'xmlschemaset.Compile'. This results in numerous exceptions. It complains about numerous duplicate definitions and invalid redefines. :(
None of these errors are reported by Oxygen. :?

Has anyone had this problem before or aware of a solution?

regards
Allan
kind regards
Allan
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Loading set of schemas in .NET 2.0

Post by sorin_ristache »

Hello,

It seems that either you did not set some parser properties on the Microsoft parser before applying it to your schemas or the Microsoft XML parser which parses and validates your XML Schemas is not compliant with the W3C XML Schema specification. As far as I know the Xerces parser which oXygen uses for validating XML Schemas is compliant with the specification.


Regards,
Sorin
adobra
Posts: 6
Joined: Tue Oct 09, 2007 11:57 am
Location: Perth, Western Australia

Re: Loading set of schemas in .NET 2.0

Post by adobra »

Thanks Sorin. But there are very few properties I can find in the .NET XMLSchemaSet object that would have a bearing on this. If you have any suggestions I'd be happy to hear them.

The only one I can find is the CompilationSettings property, which can be set to an object of type XMLSchemaCompilationSettings. This object has only 1 member, a boolean which enables or disables checking for something called Unique Particle Attribution violations. I'm not sure I even understand what they are, but I have tried both enabling and disabling them, and the same errors appear either way when the XMLSchemaSet.Compile method is called.

The .NET framework also does some checking when an individual schema is added to the XMLSchemaSet, but when I add the "root" schema, no errors are reported. It correctly resolves and loads included and imported schemas, so when I add the root schema I end up with 9 schemas in my schema set. Everything seems happy, until the Compile. From what I read, I cannot avoid calling the Compile method.

Regards
Allan
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Loading set of schemas in .NET 2.0

Post by sorin_ristache »

Hello,

Unfortunately I don't know how the XML Schema validation works in .NET 2.0 or what parser properties you should set. As far as I know the XML Schema validator of oXygen conforms to the W3C specification. If you think there is a validation error that the oXygen validator fails to report please post a sample here that shows the problem so that we can check if your schema is valid or not. If you cannot create a small cut down sample you can send us the whole schema and specify where a validation error should be reported in oXygen but it is not reported.


Regards,
Sorin
adobra
Posts: 6
Joined: Tue Oct 09, 2007 11:57 am
Location: Perth, Western Australia

Re: Loading set of schemas in .NET 2.0

Post by adobra »

The full schemas are too big to post here. I have put a zipfile containing them at http://spatialdev.skm.com.au/schemas/DSG-2008-1-15.zip

There is also a zipfile containing a trivial test VS2005 project at http://spatialdev.skm.com.au/schemas/TestSchema.zip

In the schemas, the gmd_ADO directory represents the initial effort by another group to redefine the ISO19139 elements to meet their requirements whilst still leaving the main ISO19139 directories intact and unchanged. The gmd_DSG directory represents our effort utilising the schemas in the gmd_ADO with minor modifications to meet our own requirements. This is a cooperative effort between 2 groups. All these schemas validate OK using oXygen version 8.2. Both 'Schema Full Checking' and 'Honour all Schema Locations' options are set in oXygen.

The "root" schema is either gmd.xsd or ADO_gmd.xsd. This is what I point my VS2005 project at when I run it. You will see if you do this that it reports 3 errors when loading the "straight" gmd.xsd schema, and about 15 or so when loading the ADO_gmd.xsd schema.

Thanks
kind regards
Allan
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Loading set of schemas in .NET 2.0

Post by sorin_ristache »

I do not have Visual Studio installed and I do not know why you get errors with the .NET 2.0 validator but I loaded both gmd.xsd and ADO_gmd.xsd in oXygen which reported no validation errors. I think the two schemas are valid. You should check if there are any validation properties set incorrectly for your parser in the Visual Studio project.


Regards,
Sorin
adobra
Posts: 6
Joined: Tue Oct 09, 2007 11:57 am
Location: Perth, Western Australia

Re: Loading set of schemas in .NET 2.0

Post by adobra »

Thanks Sorin. One error that does appear to be a "real" error is on line 423 of coverage.xsd. There is an empty <choice /> element there, which definitely appears invalid, or at least somewhat questionable. It' a bit worrying, because this code is in the original ISO19139 schemas - it's not a change or addition made by us.

Anyway, .NET complains about this, but oXygen doesn't report it. Can you have a look at it, and say if you believe it is something that should raise an error, or at least a warning?
kind regards
Allan
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Loading set of schemas in .NET 2.0

Post by sorin_ristache »

Syntactically it is allowed but I think an XML parser just ignores an empty <choice /> element. I validated coverage.xsd with a few parsers and that line has no effect.


Regards,
Sorin
Post Reply