C++ Implementation

MSXML makes the validation task a bit easier in some ways and a bit harder in others. Validation is easier once you've figured out how MSXML does things, but figuring out how it does things can be kind of hard.

One of the benefits of MSXML is that it has a separate validate method in addition to the load method. This is very handy, but it is also a bit confusing because the default behavior of the load method is to validate while parsing (a feature of MSXML that is not very well documented). This behavior can be changed, as we'll see with input validation. That aside, separating loading and validation is handy because when XML is our output, once we have built the DOM Document in memory we can call the validate method to validate the DOM Document against its schema before we save it.

There is, however, a bit of setup involved in validation and there are some “gotchas” lurking out there to bite unwary passersby. Let's look at input validation first because it is simpler.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset