473,387 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

XmlReader Schema Validation Not Pickign Up All Errors

Hello,
I'm having a problem when trying to use the XmlReader.Create(nodeReader,
settings) method to validate an XML document against a schema.

The problem is that if there are multiple missing required elements in the
document, the validation is only picking up the first one and none of the
others.

For example given the following schema and xml
<s:schema elementFormDefault="qualified"
targetNamespace="http://www.mydomain.com/schemas/Organisation/v1.0.0"
xmlns:oi="http://www.mydomain.com/schemas/Organisation/v1.0.0"
xmlns:s="http://www.w3.org/2001/XMLSchema">
<s:element name="organisation" nillable="true" type="oi:organisationType" />
<s:complexType name="organisationType">
<s:complexContent mixed="false">
<s:extension base="oi:nodeType">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="trading-as"
type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="also-known-as"
type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="known-as" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="registered-as"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="previously-known-as"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="turnover-amount"
type="s:double" />
<s:element minOccurs="0" maxOccurs="1" name="turnover-range-code"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="employee-count"
type="s:int" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>
</schema>
<?xml version="1.0" encoding="utf-8"?>
<oi:organisation
xmlns:oi="http://www.mydomain.com/schemas/Organisation/v1.0.0" >
<oi:trading-as />
<oi:previously-known-as>Flutterbys Inc</oi:previously-known-as>
<oi:turnover-amount>50</oi:turnover-amount>
<oi:turnover-range-code />
<oi:employee-count>5</oi:employee-count>
</oi:organisation>

The only thing it responds with is
"Validation Error: The element 'organisation' in namespace
'http://www.mydomain.com/schemas/Organisation/v1.0.0' has invalid child
element 'previously-known-as' in namespace
'http://www.mydomain.com/schemas/Organisation/v1.0.0'. List of possible
elements expected: 'also-known-as' in namespace
'http://www.mydomain.com/schemas/Organisation/v1.0.0'.,\r\n Error,\r\n
System.Xml.Schema.XmlSchemaValidationException: The element 'organisation' in
namespace 'http://www.mydomain.com/schemas/Organisation/v1.0.0' has invalid
child element 'previously-known-as' in namespace
'http://www.mydomain.com/schemas/Organisation/v1.0.0'. List of possible
elements expected: 'also-known-as' in namespace
'http://www.mydomain.com/schemas/Organisation/v1.0.0'.\r\n"

Which only indicates that one of the required elements is missing, even
though there are 3 reuiqred elements missing. How can I get the reader to
tell me all of the missing elements that need to be fixed?
Nov 3 '05 #1
0 1740

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: kinryuu | last post by:
I am setting up an XmlReader in .NET 2.0 beta2. I'm trying to migrate away from the now deprecated XmlValidatingReader. The XML files I'm reading have an in-line schema. I'm noticing several...
0
by: Matthew Heironimus | last post by:
According to the XML 1.0 (Third Edition) W3C Recommendation (http://www.w3.org/TR/2004/REC-xml-20040204/#sec-line-ends) all #xD, #xA, and #xD#xA character combinations should be converted to a...
1
by: Matthew Heironimus | last post by:
According to the XML 1.0 (Third Edition) W3C Recommendation (http://www.w3.org/TR/2004/REC-xml-20040204/#sec-line-ends) all #xD, #xA, and #xD#xA character combinations should be converted to a single...
2
by: Ali | last post by:
I am having problem compiling schema contained in WSDL file when analyzing schema types contained in it (for example http://www.ebout.net/net/GoogleSearch.wsdl). Following code demonstrates my...
1
by: billa1972 | last post by:
Hi, I am trying to hook into Yellow Freight's rating webservice. Below is the wsdl. When i try and create a proxy file with wsdl.exe i get the following errors, see below. Also, when i...
0
by: RockyH | last post by:
Hello, I'm having a problem when trying to use the XmlReader.Create(nodeReader, settings) method to validate an XML document against a schema. The problem is that if there are multiple missing...
9
by: mstilli | last post by:
Hi, I am trying to use schema for server side validation using xerces to catch the validation errors. validating this XML: <Content4> <textarea13></textarea13>...
1
by: engwar | last post by:
The title says it all. How do I use XMLDocument.Validate() against a DTD. In all my Googling about this I only find examples of how to validate an XMLReader or XmlValidatingReader against a DTD....
9
by: Tony Johansson | last post by:
Hello! First of all does every Xml document have a schema ? I'm trying to get the right feeling for what a xml schema is ? As far as I understand it's used for defining a structure how you are...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.