[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Best practice for XSD enumeration values?
- From: Roger L Costello <costello@mitre.org>
- To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
- Date: Wed, 16 Feb 2022 15:54:10 +0000
Hi Folks,
This simpleType has a list of enumeration values:
<xs:simpleType name="AirportType">
<xs:restriction base="xs:string">
<xs:enumeration value="active civil airport" />
<xs:enumeration value="active military airport" />
<xs:enumeration value="active joint (civil and military)" />
<xs:enumeration value="active airport having permanent type surface runways" />
</xs:restriction>
</xs:simpleType>
What do you think about those enumeration values? Good? Bad?
A colleague told me: Whitespaces in enumeration values are evil." Do you agree? On the one hand, whitespace enables a value to be easily read. On the other hand, when someone is creating an XML document they might accidentally insert two spaces between words, thus yielding invalid data. Whitespaces good or bad?
The same colleague recommended slamming the words together, and uppercase the first letter of following words, e.g., change "active civil airport" to "activeCivilAirport". But what about values with punctuation such as this value "active joint (civil and military)"? Slamming those words together will create a mess. Should punctuation be prohibited in enumeration values?
This is a pretty long enumeration value: "active airports having permanent type surface runways". Are long values bad? Is there a recommended limit to the length of enumeration values?
I am interested in hearing your thoughts on this issue.
/Roger
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]