|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
schema enumeration
I am trying to implement a schema enumeration, but its not working.
The xml file below has what should be an invalid value, but it doesn't get flagged What is wrong? myfile.xsd ---------------------------------------------------------------------------------- <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www/w3/org/1999/XMLSchema"> <xsd:annotation> <xsd:documentation> My File </xsd:documentation> </xsd:annotation> <xsd:element name="my_root_element"> <xsd:complexType> <xsd:sequence> <xsd:element ref="my_element" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="my_element"> <xsd:complexType> <xsd:sequence> <!-- color values --> <simpleType name='color_values'> <annotation> <documentation>Valid Color Values</documentation> </annotation> <restriction base='string'> <enumeration value='R'> <annotation> <documentation>Red</documentation> </annotation> </enumeration> <enumeration value='G'> <annotation> <documentation>Green</documentation> </annotation> </enumeration> <enumeration value='B'> <annotation> <documentation>Blue</documentation> </annotation> </enumeration> </restriction> </simpleType> <xsd:element name="color" type="color_values" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> </xsd:element> <!-- end --> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> myfile.xml ------------------------------------------------------------------------------------------ <my_root_element xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:myfile.xsd" > <my_element> <color>R</color> <color>x</color> </my_element> </my_root_element> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > schema enumeration |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|