473,327 Members | 1,976 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,327 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 1753
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.