Groups | Blog | Home
all groups > dotnet xml > april 2007 >

dotnet xml : Urgent problem with System.Xml.Schema.XmlSchema



JMD
4/17/2007 1:28:18 PM
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 it works
fine. Occasionally it gives an error in the schema compiler:


"System.Xml.Schema.XmlSchemaException: Wildcard '##other' allows
element 'Page', and causes the content model to become ambiguous. A
content model must be formed such that during validation of an element
information item sequence, the particle contained directly, indirectly
or implicitly therein with which to attempt to validate each item in
the sequence in turn can be uniquely determined without examining the
content or attributes of that item, and without any information about
the items in the remainder of the sequence.
at
System.Xml.Schema.BaseProcessor.SendValidationEvent(XmlSchemaException
e, XmlSeverityType severity)
at System.Xml.Schema.BaseProcessor.SendValidationEvent(String code,
String msg1, String msg2, XmlSchemaObject source)
at
System.Xml.Schema.SchemaCollectionCompiler.CompileComplexContent(XmlSchemaComplexType
complexType)
at
System.Xml.Schema.SchemaCollectionCompiler.CompileComplexType(XmlSchemaComplexType
complexType)
at System.Xml.Schema.SchemaCollectionCompiler.Compile()
at System.Xml.Schema.SchemaCollectionCompiler.Execute(XmlSchema
schema, SchemaInfo schemaInfo, Boolean compileContentModel)
at System.Xml.Schema.XmlSchema.CompileSchema(XmlSchemaCollection
xsc, XmlResolver resolver, SchemaInfo schemaInfo, String ns,
ValidationEventHandler validationEventHandler, XmlNameTable nameTable,
Boolean CompileContentModel)
at System.Xml.Schema.XmlSchemaCollection.Add(String ns, SchemaInfo
schemaInfo, XmlSchema schema, Boolean compile, XmlResolver resolver)
at System.Xml.Schema.XmlSchemaCollection.Add(String ns, XmlRea""der
reader, XmlResolver resolver)
at System.Xml.Schema.XmlSchemaCollection.Add(String ns, String uri)



A search on Google didn't find anything other than people debugging
actual errors in their schemas. Please help ASAP.
John Saunders [MVP]
4/17/2007 5:09:40 PM
[quoted text, click to view]


Actually, this sounds like an actual error in your schema, but perhaps one
which is only occasionally detected by .NET.

I suggest you take a look at that portion of your schema and attempt to
create ambiguous documents. If you succeed, then .NET is telling you the
truth about your schema (though perhaps it should tell you all of the time,
and not just sometimes).

Also, if it's dependent on the XML being validated, then perhaps you should
try capturing the XML that .NET is complaining about.
--

John Saunders [MVP]

JMD
4/18/2007 7:27:01 AM

[quoted text, click to view]

I've also tried getting a second opinion on the schema validation.
There are no problems reported with xsdvalid, nor with Altova,
validating the same XML file against the schema.

[quoted text, click to view]

The error message does not make sense. 'Page' is a local element, one
of several children. The ##other will only accept additional elements
that are in a different namespace, and there is no default namespace
specified in the document. So an unqualified name is unambiguously
the defined child element.

[quoted text, click to view]

The same XML file will work most of the time and not work on
occasion. The error trace indicates that the exception takes place
when adding the schema to the schemalist, which is done before the
actual XML file of interest is read.
John Saunders [MVP]
4/18/2007 1:20:07 PM
[quoted text, click to view]


Ok, sorry, I misread your post. I thought this was a validation problem. In
fact, if you can reproduce it simply by adding the schema to the list, then
this has nothing to do with validation.

Can you post details of a reproducer that just causes the error on loading
the schema? I know it doesn't happen all the time, but could you create an
example and run it repeatedly or something like that? Also, please post the
code and the schema and include specifics of which Visual Studio version
you're using, OS version, service packs, etc?
--
John Saunders [MVP]

AddThis Social Bookmark Button