469,076 Members | 1,315 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,076 developers. It's quick & easy.

.Net XmlValidatingReader should fail on complextypes with whitespace?

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:element ref="BuyerSellerReferrorFlag" minOccurs="0"

XML fragment:


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

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

XmlValidatingReader validatingReader = new XmlValidatingReader(textReader);

validatingReader.ValidationType = ValidationType.Schema;


catch(Exception ex)
Jul 20 '05 #1
0 1413

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.