By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,478 Members | 1,833 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,478 IT Pros & Developers. It's quick & easy.

Urgent problem with System.Xml.Schema.XmlSchema

P: n/a
JMD
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.SendValidationEven t(XmlSchemaException
e, XmlSeverityType severity)
at System.Xml.Schema.BaseProcessor.SendValidationEven t(String code,
String msg1, String msg2, XmlSchemaObject source)
at
System.Xml.Schema.SchemaCollectionCompiler.Compile ComplexContent(XmlSchemaComplexType
complexType)
at
System.Xml.Schema.SchemaCollectionCompiler.Compile ComplexType(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(XmlSchem aCollection
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.

Apr 17 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"JMD" <11*******@sneakemail.comwrote in message
news:11**********************@q75g2000hsh.googlegr oups.com...
>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.SendValidationEven t(XmlSchemaException
e, XmlSeverityType severity)
at System.Xml.Schema.BaseProcessor.SendValidationEven t(String code,
String msg1, String msg2, XmlSchemaObject source)
at
System.Xml.Schema.SchemaCollectionCompiler.Compile ComplexContent(XmlSchemaComplexType
complexType)
at
System.Xml.Schema.SchemaCollectionCompiler.Compile ComplexType(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(XmlSchem aCollection
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.

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]
Apr 17 '07 #2

P: n/a
JMD

John Saunders [MVP] wrote:
Actually, this sounds like an actual error in your schema, but perhaps one
which is only occasionally detected by .NET.
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.
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).
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.
Also, if it's dependent on the XML being validated, then perhaps you should
try capturing the XML that .NET is complaining about.
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.

Apr 18 '07 #3

P: n/a
"JMD" <11*******@sneakemail.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
>
John Saunders [MVP] wrote:
>Actually, this sounds like an actual error in your schema, but perhaps
one
which is only occasionally detected by .NET.

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.
>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).

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.
>Also, if it's dependent on the XML being validated, then perhaps you
should
try capturing the XML that .NET is complaining about.

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.

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]
Apr 18 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.