473,657 Members | 2,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Urgent problem with System.Xml.Sche ma.XmlSchema

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.Sch ema.XmlSchemaEx ception: 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.Sche ma.BaseProcesso r.SendValidatio nEvent(XmlSchem aException
e, XmlSeverityType severity)
at System.Xml.Sche ma.BaseProcesso r.SendValidatio nEvent(String code,
String msg1, String msg2, XmlSchemaObject source)
at
System.Xml.Sche ma.SchemaCollec tionCompiler.Co mpileComplexCon tent(XmlSchemaC omplexType
complexType)
at
System.Xml.Sche ma.SchemaCollec tionCompiler.Co mpileComplexTyp e(XmlSchemaComp lexType
complexType)
at System.Xml.Sche ma.SchemaCollec tionCompiler.Co mpile()
at System.Xml.Sche ma.SchemaCollec tionCompiler.Ex ecute(XmlSchema
schema, SchemaInfo schemaInfo, Boolean compileContentM odel)
at System.Xml.Sche ma.XmlSchema.Co mpileSchema(Xml SchemaCollectio n
xsc, XmlResolver resolver, SchemaInfo schemaInfo, String ns,
ValidationEvent Handler validationEvent Handler, XmlNameTable nameTable,
Boolean CompileContentM odel)
at System.Xml.Sche ma.XmlSchemaCol lection.Add(Str ing ns, SchemaInfo
schemaInfo, XmlSchema schema, Boolean compile, XmlResolver resolver)
at System.Xml.Sche ma.XmlSchemaCol lection.Add(Str ing ns, XmlRea""der
reader, XmlResolver resolver)
at System.Xml.Sche ma.XmlSchemaCol lection.Add(Str ing 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
3 4480
"JMD" <11*******@snea kemail.comwrote in message
news:11******** **************@ q75g2000hsh.goo glegroups.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.Sch ema.XmlSchemaEx ception: 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.Sche ma.BaseProcesso r.SendValidatio nEvent(XmlSchem aException
e, XmlSeverityType severity)
at System.Xml.Sche ma.BaseProcesso r.SendValidatio nEvent(String code,
String msg1, String msg2, XmlSchemaObject source)
at
System.Xml.Sche ma.SchemaCollec tionCompiler.Co mpileComplexCon tent(XmlSchemaC omplexType
complexType)
at
System.Xml.Sche ma.SchemaCollec tionCompiler.Co mpileComplexTyp e(XmlSchemaComp lexType
complexType)
at System.Xml.Sche ma.SchemaCollec tionCompiler.Co mpile()
at System.Xml.Sche ma.SchemaCollec tionCompiler.Ex ecute(XmlSchema
schema, SchemaInfo schemaInfo, Boolean compileContentM odel)
at System.Xml.Sche ma.XmlSchema.Co mpileSchema(Xml SchemaCollectio n
xsc, XmlResolver resolver, SchemaInfo schemaInfo, String ns,
ValidationEvent Handler validationEvent Handler, XmlNameTable nameTable,
Boolean CompileContentM odel)
at System.Xml.Sche ma.XmlSchemaCol lection.Add(Str ing ns, SchemaInfo
schemaInfo, XmlSchema schema, Boolean compile, XmlResolver resolver)
at System.Xml.Sche ma.XmlSchemaCol lection.Add(Str ing ns, XmlRea""der
reader, XmlResolver resolver)
at System.Xml.Sche ma.XmlSchemaCol lection.Add(Str ing 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
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
"JMD" <11*******@snea kemail.comwrote in message
news:11******** **************@ n76g2000hsh.goo glegroups.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2924
by: Rob Mayo | last post by:
I have a bunch of XSD files in my assembly as embedded content that are read out via reflection and streams. My app creates the XML on the fly, and I want to validate it using the schema files embedded in my assembly. Unfortunately, my problem is that every element is coming up invalid. Here is the code: Public Sub Validate(ByVal XmlText As String)Dim strmXML As New System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(XmlText))Dim...
2
1530
by: Rajesh Jain | last post by:
I Have 2 separate schemas. --------------Schema 1 is defined as below----------- <xs:schema targetNamespace="http://Schemas/1" xmlns="http://Schemas/1" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="Loan"> <xs:complexType> <xs:sequence> <xs:element name="Borrower" maxOccurs="unbounded"> <xs:complexType> <xs:attribute name="BorrID" use="required">
11
3372
by: Ceri Williams | last post by:
I followed the excellent MSDN article "Code Generation in the .NET Framework Using XML Schema" to build a substitute for the limited xsd.exe. My code works fine under .NET framework 1.1, but after installing .net framework service pack 1, my code breaks. Below are trivial example files that demonstrate the problem: XSD FILE aaa.xsd ---------------------- <?xml version="1.0" encoding="UTF-8"?>
3
5047
by: Mae | last post by:
Dear All, I have a problem here, I'm using C# Webform calling a webservices. The webservices return me a XMLnode, using this XMLnode I want to convert it to dataset so I can bind to the datagrid, by extracting the <CustomerData></CustomerData> block from the xmlnode. Below is the sample of xmlnode return from webservices. <?xml version="1.0" encoding="utf-8"?>
1
3423
by: leslie_tighe | last post by:
Hello, I have webservice created with Axis 1.2.1 and that I am trying to consuming in .NET (VB) using the Microsoft provided tools. While I am able to consume methods on the service that return simple type, I cannot consume methods that return complex objects. I have tried experimenting, with this, but am at a bit of loss on where the problem lies. When I call the services from a browser, I do get back the response that contains valid...
0
1121
by: Stefan Christmann | last post by:
I am validating XML-Documents with XML-schema-files and the C#-standard-functions. I have one XSD-document which is syntactically 100% correct after W3C-standard, but the schema compiler dies with an InvalidCastException (debug message following). Has anyone had this error already? Seems to be a bug inside 'mscorlib'. Thanks, Stefan
1
2857
by: louis_la_brocante | last post by:
Dear all, I am having trouble generating a client proxy for a webservice whose methods return a "complex" type. The type is complex in that it is a class whose members are a mix of primitive types and of more elaborate classes implementing IXmlSerializable. The resulting WSDL file for the webservice has two separate schemas in its <types> sections, and the client proxy (generated with wsdl.exe) is missing the definitions of the...
1
3820
by: Angel \Java\ Lopez | last post by:
Hi people! I'm running a Visual Studio 2005, Professional, on Windows XP Professional. I've found a little big problem, reading a DataSet. If I try: ds.ReadXml("c:\data.xml") it raises the exception ONLY in Web Sites:
1
4020
by: Ryan | last post by:
Hello Xml Gurus, I'm trying to build an XML schema in memory using the System.Xml.XmlSchema namespace objects, validate it, and then write it to a file. The problem I'm facing is that XmlSchema.Write() is changing <xsd:element minOccurs="1" name="AccountId" type="s-xsd:primarykey" /> to be
0
8407
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8319
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8837
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8512
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8612
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7347
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6175
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.