We have a lot of serialization done through MS XML 4. When we serialize C ++ enums, we use a table to translate each possible value into a string, and they save that string as an attribute value. When we deserialize, we read this attribute value, compare it with all the elements in the table, and extract the corresponding enumeration value. If we cannot find a mistake, we will make a mistake.
To facilitate the creation of XML files by external programs, we have published XML schemas for all data types of interest. Attributes for enumerations are defined as follows:
<xs:complexType>
//other fields here
<xs:attribute name="Color" type="xs:string"></xs:attribute>
</xs:complexType>
It works, but does not contain definitions for possible string values. How can I add possible values to this definition? I am using xs: choice for this?
source
share