Example 4: Validating with an Inline XSD Schema (Visual Basic)
Note The information in this topic applies to MSXML 5.0 for Microsoft Office Applications and later.
In MSXML 5.0 for Microsoft Office Applications and later, support for inline XSD schemas provides another alternative for validating documents. Inline XSD schemas are a good approach when you want to have the schema included or merged directly within document that uses it for validation. For simple document types where the schema is stable and unlikely to change, this approach works well. For more complex document types or if your schema is modified often, inline schema solutions are not as effective.
In the following example, we will create two versions of an XML resource file (valid.xml and notValid.xml) that include XSD schemas. The two files are nearly identical, with only one slight difference: the
<price> element in valid.xml, which is declared in the schema, has been replaced with an undeclared
<cost> element in notValid.xml.
We've provided source files for the sample in three languages: JScript, Visual Basic, and C++. The output is the same in each language.