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

Home Posts Topics Members FAQ

XmlReader Schema Validation Not Pickign Up All Errors

Hello,
I'm having a problem when trying to use the XmlReader.Creat e(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 elementFormDefa ult="qualified"
targetNamespace ="http://www.mydomain.co m/schemas/Organisation/v1.0.0"
xmlns:oi="http://www.mydomain.co m/schemas/Organisation/v1.0.0"
xmlns:s="http://www.w3.org/2001/XMLSchema">
<s:element name="organisat ion" nillable="true" type="oi:organi sationType" />
<s:complexTyp e name="organisat ionType">
<s:complexConte nt mixed="false">
<s:extension base="oi:nodeTy pe">
<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="registere d-as"
type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="previousl y-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:complexConten t>
</s:complexType>
</schema>
<?xml version="1.0" encoding="utf-8"?>
<oi:organisatio n
xmlns:oi="http://www.mydomain.co m/schemas/Organisation/v1.0.0" >
<oi:trading-as />
<oi:previousl y-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.co m/schemas/Organisation/v1.0.0' has invalid child
element 'previously-known-as' in namespace
'http://www.mydomain.co m/schemas/Organisation/v1.0.0'. List of possible
elements expected: 'also-known-as' in namespace
'http://www.mydomain.co m/schemas/Organisation/v1.0.0'.,\r\n Error,\r\n
System.Xml.Sche ma.XmlSchemaVal idationExceptio n: The element 'organisation' in
namespace 'http://www.mydomain.co m/schemas/Organisation/v1.0.0' has invalid
child element 'previously-known-as' in namespace
'http://www.mydomain.co m/schemas/Organisation/v1.0.0'. List of possible
elements expected: 'also-known-as' in namespace
'http://www.mydomain.co m/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 1751

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

Similar topics

0
1267
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 alarming problems: 1) The documentation for XmlReader says to use and XmlReaderSettings object and to either add or remove IgnoreInlineSchema from the ValidationFlags property as desired. Well, the ValidationFlags property uses the...
0
2218
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 #xA character. According to the "Reading XML with the XmlReader" section of the ".NET Framework Developer's Guide" on-line help, the XmlReader will not perform this normalization by default. You can cause the XmlReader to perform this
1
5346
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 #xA character. According to the "Reading XML with the XmlReader" section of the ".NET Framework Developer's Guide" on-line help, the XmlReader will not perform this normalization by default. You can cause the XmlReader to perform this...
2
7303
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 problem: using System.Diagnostics; using System.IO; using System.Xml; using System.Xml.Schema;
1
6396
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 reference this wsdl in .NET it seems to do it fine, yet there are no objects to reference except RateQuoteBeanService. In the WSDL it looks like there should be getRateQuote, and QUOTEREQUEST, etc.
0
261
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 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"
9
3008
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> <binaryobject3></binaryobject3>
1
7776
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. The reason I want to avoid the readers is that I want an XmlDocument that is not forward-only so I can loop through the doc again after validating it.
9
1523
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 permitted to right your Xml document. Is it possible to make a simile to C# in some sensible way. //Tony
0
8395
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
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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
8605
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
7330
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
6166
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...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.