Validate XML - Unable to add Schema to Schema Collection
I have some xml validation code that validates xml against an external schema. Problem is that it doesn't entirely work for some of the complex OTA (www.opentravel.org) xsd that I am trying to validate against. These schemas have multiple included schemas and refernces to other schemas and attribute groups.
When I try to add one of these schemas to my schemacollection it errors out because it is unable to find some of the types defined in the included schemas. It seems to do fine going down one level to a referenced schema, but once that schema references another schema that is when I get errors.
The schema I am specifically trying to validate against is OTA_TravelItineraryRS.xsd, I am using the supplied sample xml file, but when I validate it throws up an error in one of the included schemas about "Type 'Money' is not declared or not a simple type. An error occurred at file:///C:/Delete/OTA_CommonTypes.xsd, (85, 4). " I have tried other OTA schemas and sample files and get very similar errors.
All of the schemas are locally in the same directory. To get to this error essentially the OTA_TravelItineraryRS.xsd includes other schemas one of which is OTA_CommonTypes.xsd. The money type that the error is talking about is found in OTA_SimpleTypes.xsd which is referenced by OTA_CommonTypes.xsd (technically 2 files deep).
Everything pans out and the code seems to be smart enough to drill down to CommonTypes schema to get info for the TravelItinerary, but once there it needs to drill down to SimpleTypes and for some reason its not doing it. Any ideas?
If you need more info let me know. I have attached the entire OTA 2004B schema that includes all the xsd and sample xml files if you want to try it out for yourself.
Last edited by coenen; Dec 28th, 2004 at 03:47 PM.
Re: Validate XML - Unable to add Schema to Schema Collection
I don't have an answer, but I've seen similar posts on other forums when dealing with complex schemas, especially when they self-reference. In particular, the jxdd from the Deparment of Justice.
From posts I've seen, it appears that the .NET Microsoft stuff may not be that robust. You may want to try with other languages/validators, or even XMLSpy to see if there's a difference.
Re: Validate XML - Unable to add Schema to Schema Collection
Yeah I was kind of thinking it was a .Net weakness......the files validate great in XML Spy.....only problem is I need to programatically validate these files in .net as part of my transform process
Mike if you could shoot me some links to other threads in other forums on this topic or atleast point me in the right direction it would be greatly appreciated. Would like to see what others have to say on this issue. I am able to get around the issue by using a flattened schema that is provided by OTA that has all of the extra included schemas, attributes, types, etc all jammed into one big ugly file, but ideally would like to use the schema the way it was designed.
Last edited by coenen; Dec 28th, 2004 at 06:01 PM.