473,406 Members | 2,956 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,406 software developers and data experts.

repost-.Net XmlValidatingReader should fail on complextypes withwhitespace?

Reposting due to lack of response - I believe the .Net
XmlValidatingReader should fail when validating XML that contains a
ComplexType element with white space when the ComplexType element has
the mixed attribute set to false in the XSD used for validation.

XSD fragment:

<xs:element name="TRSellerBuyerData">
<xs:complexType mixed="false">
<xs:sequence>
<xs:element ref="BuyerSellerReferrorFlag" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>

XML fragment:

<TRSellerBuyerData>
</TRSellerBuyerData>

XML Spy will catch the valdation error and report: "Text not allowed
inside element 'TRSellerBuyerData'

But the following code does not catch the validation error. Is this a
bug in XmlValidatingReader - or am I missing code to catch this? I
assume by XSD is correct since XmlSpy catches the error.
XmlTextReader textReader = new XmlTextReader(reader);

textReader.WhitespaceHandling = WhitespaceHandling.All; //this is the
default

textReader.Normalization = false; //this is the default

XmlValidatingReader validatingReader = new XmlValidatingReader(textReader);

validatingReader.ValidationType = ValidationType.Schema;

validatingReader.Schemas.Add(schemaCollection);

try
{
while(validatingReader.Read());
}
catch(Exception ex)
{
Debug.WriteLine(ex.Message);
}
-Larry
Jul 20 '05 #1
1 1758
I think this is a bug in XML Spy - non-significant whitespace should be
ignored.
Following instance will give you an error:
<TRSellerBuyerData xml:space="preserve">
</TRSellerBuyerData>

Yan
"Larry" <la***@nospam.net> wrote in message
news:MZSxc.26772$Sw.13578@attbi_s51...
Reposting due to lack of response - I believe the .Net XmlValidatingReader
should fail when validating XML that contains a ComplexType element with
white space when the ComplexType element has the mixed attribute set to
false in the XSD used for validation.

XSD fragment:

<xs:element name="TRSellerBuyerData">
<xs:complexType mixed="false">
<xs:sequence>
<xs:element ref="BuyerSellerReferrorFlag" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>

XML fragment:

<TRSellerBuyerData>
</TRSellerBuyerData>

XML Spy will catch the valdation error and report: "Text not allowed
inside element 'TRSellerBuyerData'

But the following code does not catch the validation error. Is this a bug
in XmlValidatingReader - or am I missing code to catch this? I assume by
XSD is correct since XmlSpy catches the error.
XmlTextReader textReader = new XmlTextReader(reader);

textReader.WhitespaceHandling = WhitespaceHandling.All; //this is the
default

textReader.Normalization = false; //this is the default

XmlValidatingReader validatingReader = new
XmlValidatingReader(textReader);

validatingReader.ValidationType = ValidationType.Schema;

validatingReader.Schemas.Add(schemaCollection);

try
{
while(validatingReader.Read());
}
catch(Exception ex)
{
Debug.WriteLine(ex.Message);
}
-Larry

Jul 20 '05 #2

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

Similar topics

5
by: Joe | last post by:
Please repost answer message did not make it last time Hello, Joe here, wanted to get the 411 on this article. I posted in the FrontPage forum but there is never an answer. So I have come...
4
by: Mike Lundell | last post by:
lemee try this again, for today's date :)... .............. what's wrong with this, and .. can you not declare "char" variables? #include <iostream> int main() {
2
by: Ohaya | last post by:
Hi, We've been having a problem with one particular page that has a button on it, and a "tall" image (top-to-bottom). The button calls some simple Javascript to print the frame in which the...
1
by: Fresh Air Rider | last post by:
Hi Everyone Scenario A Webage has two dropdown lists, one for Suppliers and one for Products. When a user selects a supplier, it then populates the Products dropdown list with the relevant...
0
by: rawCoder | last post by:
Hi All, This is a repost of 'Disable DataGrid AutoScroll of 3/7/2005' Its related to "WinForm DataGrid" HOW can i force the grid NOT to Auto Scroll to the ( newly added item OR last...
3
by: Adam | last post by:
I've posted about this previously, but failed to receive a satisfactory response, so have included a code sample: I am trying to receive messages from an HTML viewer control in compact.net (c#),...
14
by: Steve McLellan | last post by:
Hi, Sorry to repost, but this is becoming aggravating, and causing me a lot of wasted time. I've got a reasonably large mixed C++ project, and after a number of builds (but not a constant...
5
by: Adrian Parker | last post by:
I've got the standard SqlCacheDependency working just fine , ie. I've defined (and encrypted) the connectionStrings section in the web.config, and I've also defined an an sqlCacheDependency in the...
2
by: Gerry | last post by:
I have a combo box and I can populate it with my class of dat (the class allows me to store each userid,username called - see code below I want the user to select the dropdown and see the...
2
by: Raj | last post by:
Hi, I have the following problem. I am displaying and printing a PDF file that is generated by my Application server. The print dialogs comes up correctly for the small PDF for the larger PDFs...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
0
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,...
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...
0
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...
0
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,...
0
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...

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.