home | downloads | recipes | blogs | staff | about us | *

The Art of Lightning
XML Schema Validation Gotchas with .Net 2.0James Zimmerman6/28/2007

There's a few gotchas with using advanced capabilities of the XML Schema specifications in the .Net world. Mostly this is because some of the features are not enabled by default. Here's the list I'ver personally run across

  1. xs:key or xs:unique

    If you are using either of these constructs you need to make sure that you enable the feature by supplying the XmlSchemaValidationFlags.ProcessIdentityConstraints flag to an XmlSettings class.
  2. xpath statements are not totally compliant

    Any reference or constraints using XPath only implement a subset AND do not follow the specification when it comes to namespaces. Basically if you have a qualified document (defined as prefix tns) then write your XPath along the lines of tns:parentelement/tns:childelement. This holds true for your attributes as well!
  3. Smegged up schemas don't tell you that they're smegged up during validation

    Just set XmlSchemaValidationFlags.ReportValidationWarnings flag ALWAYS. Seriously. DO IT.
The XMl boys have some further information that might be helpful on their blog. Worth a read...

Jimmy Zimms is currently currently in his underground lair, plotting the downfall of mankind...
 

Look for more blogs |

(c) 2001-2009 Stuart Williams, E-Mail Stuart Williams