R
Russell O'Connor
The following XML and Schema doesn't validate in Visual Studio .NET 2003.
Is there some mistake I'm making, or is VS.NET in error.
The error is
r:\test2.xml(3): The key sequence 'foo' in Keyref fails to refer to some key. An error occurred at , (3, 6).
Any help is appreciated. Here is the schema.
<?xml version="1.0" ?>
<xs:schema id="NewDataSet" targetNamespace="http://tempuri.org/test2.xsd" xmlns:mstns="http://tempuri.org/test2.xsd"
xmlns="http://tempuri.org/test2.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="object" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="ref" form="unqualified" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="key" form="unqualified" type="xs:string" />
</xs:complexType>
<xs:key name="rootKey1">
<xs:selector xpath="." />
<xs:field xpath="@key" />
</xs:key>
<xs:keyref name="rootobject" refer="mstns:rootKey1">
<xs:selector xpath=".//mstnsbject" />
<xs:field xpath="@ref" />
</xs:keyref>
</xs:element>
</xs:schema>
And the XML file that fails to validate is:
<?xml version="1.0" encoding="utf-8"?>
<root xmlns="http://tempuri.org/test2.xsd" key="foo">
<object ref="foo" />
</root>
Thanks for any help.
Is there some mistake I'm making, or is VS.NET in error.
The error is
r:\test2.xml(3): The key sequence 'foo' in Keyref fails to refer to some key. An error occurred at , (3, 6).
Any help is appreciated. Here is the schema.
<?xml version="1.0" ?>
<xs:schema id="NewDataSet" targetNamespace="http://tempuri.org/test2.xsd" xmlns:mstns="http://tempuri.org/test2.xsd"
xmlns="http://tempuri.org/test2.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="object" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="ref" form="unqualified" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="key" form="unqualified" type="xs:string" />
</xs:complexType>
<xs:key name="rootKey1">
<xs:selector xpath="." />
<xs:field xpath="@key" />
</xs:key>
<xs:keyref name="rootobject" refer="mstns:rootKey1">
<xs:selector xpath=".//mstnsbject" />
<xs:field xpath="@ref" />
</xs:keyref>
</xs:element>
</xs:schema>
And the XML file that fails to validate is:
<?xml version="1.0" encoding="utf-8"?>
<root xmlns="http://tempuri.org/test2.xsd" key="foo">
<object ref="foo" />
</root>
Thanks for any help.