Skip to content

Commit

Permalink
Address issue votinginfoproject#106: document "other" used with enums.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjerdonek committed Apr 20, 2015
1 parent 5bbf930 commit cc94fc7
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions STYLEGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Markdown, etc).
* Two-space indents should be used (e.g. in place of tabs).


### Naming Styles
### Casing

+ Attributes should be camelCased - The first letter of the second and subsequent words are capitalized.
+ Elements should be TitleCased (PascalCased) - The first letter of every word is capitalized.
+ Enumerations should be spinal-case - all lower case with spaces replaced with hyphens.
Expand All @@ -51,7 +52,7 @@ Markdown, etc).
````


### Attributes
### Attribute Ordering

Attributes should appear in the following order:

Expand All @@ -69,6 +70,32 @@ For example--
```


### Enumerations and "Other"

To support "other" values in an enumeration, add the value "other"
to the enumeration type definition. For example--

```xml
<xs:simpleType name="Color">
<xs:restriction base="xs:string">
<xs:enumeration value="blue" />
<xs:enumeration value="green" />
<xs:enumeration value="other" />
<xs:enumeration value="red" />
</xs:restriction>
</xs:simpleType>
```

Then, whenever using the type in an element named `[Name]`, add an element
named `Other[Name]` with type `xs:string`. The value "other" for element
`[Name]` is a signal to look at `Other[Name]`. For example--

```xml
<xs:element name="BallotColor" type="Color" minOccurs="0" />
<xs:element name="OtherBallotColor" type="xs:string" minOccurs="0" />
```


### Type Definitions: Global vs. Local

This subsection describes when a type definition should be "global"
Expand Down

0 comments on commit cc94fc7

Please sign in to comment.