[Linq to Xml] Schema Validation fails with prefixes

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
I generate XmlReaderSettings with the schema to validate my xml document then I "return XmlReader.Create(firstXmlReader, xmlReaderSettings);"

When I try load the xml-file "XElement.Load(xmlReader);" the validation does not fail even so I manipulated the xml file so the validation should fail.
The xml file I am talking about has prefixes and the root-element looks like this:

<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; iw<span style="color:Blue; :<span style="color:#A31515; rootelement <span style="color:Red; xsi:schemaLocation<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; http://www.blablub.de blablub_123.xsd<span style="color:Black; " <span style="color:Red; xmlns:iw<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; http://www.blablub.de<span style="color:Black; " <span style="color:Red; xmlns:xsi<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; http://www.w3.org/2001/XMLSchema-instance<span style="color:Black; "<span style="color:Blue; >
[/code]

When validate the same document without prefixes the validation fails and I get the expected "XmlSchemaValidationException".
Even XDocument.Validate(schemaSet, (sender, vargs) => {}); does not throw an exception if the document has prefixes.
Can anybody help me out?!

View the full article
 
Back
Top