Faced with the crash of the application when checking XML on the schema during loading.
By the method of scientific spear, it was found that the fall is due to the null reference on XPATH.
The validation fragment in XSD looks like this:
<xs:key name="icon_name_key"> <xs:selector xpath="ws:icons/*"></xs:selector> <xs:field xpath="@name"></xs:field> </xs:key> <xs:keyref name="small_icon_name_refer" refer="r:icon_name_key"> <xs:selector xpath=".//."></xs:selector> <xs:field xpath="@small_icon"></xs:field> </xs:keyref> <xs:keyref name="large_icon_name_refer" refer="r:icon_name_key"> <xs:selector xpath=".//."></xs:selector> <xs:field xpath="@large_icon"></xs:field> </xs:keyref> By itself, XML looks something like this:
<template> <icons> <icon name='icon1'></icon> <icon name='icon2'></icon> <icon name='icon3'></icon> <icon name='icon4'></icon> </icons> <categories> <cagegory> <panel> <button small_icon='icon1'></button> <button large_icon='icon2'> <button small_icon='icon3'> <button small_icon='icon4'></button> </button> <label small_icon='icon1'></label> </button> <label small_icon='icon1'></label> </panel> </category> </categories> </template> As I understand it, the fall is due to the fact that not all elements may have one of the attributes small_icon or large_icon.
Actually the question is, if this is a microsoft error when checking xml with the help of a schema via msxml6, then how can you get around this situation?
The essence of the problem: check if the attribute in the <category> @small_icon or @large_icon attribute is present in <icons>\<icon[@name]>
PS: Visual Studio 2013 perfectly handles this test within its designer / editor.