A
aevans1108
Greetings
I can't seem to inherit enumerated values from a globally defined type
in my XML schema. XmlSchema.Compile() doesn't like it.
Here's the schema.
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:simpleType name="MYTYPE">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Option1" />
<xsd:enumeration value="Option2" />
<xsd:enumeration value="Option3" />
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="Element1" default="Option1">
<xsd:simpleType>
<xsd:restriction base="MYTYPE">
<xsd:enumeration value="Option4" />
<xsd:enumeration value="Option5" />
<xsd:enumeration value="Option6" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:schema>
Here's the C# source.
const String FILENAME = @"d:\work\schemaTest\schemaTest2.xsd";
static protected void ValidationCallbackOne(object sender,
ValidationEventArgs args)
{
Console.WriteLine( args.Message );
}
static void Main()
{
XmlSchema schema = XmlSchema.Read( new XmlTextReader( FILENAME ),
null );
schema.Compile(new ValidationEventHandler(ValidationCallbackOne));
}
Here's the output.
The Enumeration constraint failed. An error occurred at
file:///d:/work/schemaTest/schemaTest2.xsd, (13, 10).
Does anyone have any clues? As always, guesses are welcome.
Thanks!
Tony
I can't seem to inherit enumerated values from a globally defined type
in my XML schema. XmlSchema.Compile() doesn't like it.
Here's the schema.
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:simpleType name="MYTYPE">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Option1" />
<xsd:enumeration value="Option2" />
<xsd:enumeration value="Option3" />
</xsd:restriction>
</xsd:simpleType>
<xsd:element name="Element1" default="Option1">
<xsd:simpleType>
<xsd:restriction base="MYTYPE">
<xsd:enumeration value="Option4" />
<xsd:enumeration value="Option5" />
<xsd:enumeration value="Option6" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:schema>
Here's the C# source.
const String FILENAME = @"d:\work\schemaTest\schemaTest2.xsd";
static protected void ValidationCallbackOne(object sender,
ValidationEventArgs args)
{
Console.WriteLine( args.Message );
}
static void Main()
{
XmlSchema schema = XmlSchema.Read( new XmlTextReader( FILENAME ),
null );
schema.Compile(new ValidationEventHandler(ValidationCallbackOne));
}
Here's the output.
The Enumeration constraint failed. An error occurred at
file:///d:/work/schemaTest/schemaTest2.xsd, (13, 10).
Does anyone have any clues? As always, guesses are welcome.
Thanks!
Tony