Digital humanities


Maintained by: David J. Birnbaum (djbpitt@gmail.com) [Creative Commons BY-NC-SA 3.0 Unported License] Last modified: 2015-09-19T23:29:31+0000


Patterns, anti-patterns, and other Relax NG details

Homework notes to the instructors from students in Relax NG and elsewhere

Well-formedness and validation

Using a Relax NG schema

Relax NG patterns and anti-patterns

Pattern: the repeatable or group in mixed content

Anti-pattern: nested repetition indicators

Pattern: named values

Pattern: where to declare attributes in Relax NG

xml:id and unique identifiers

The example below has an error: the value time is assigned to the xml:id attribute for two different elements. If in your schema you define xml:id as being of type xsd:ID, all xml:id values in the entire document must be unique.

<types>
    <type xml:id="money"/>
    <type xml:id="time"/>
    <type xml:id="weight"/>
    <type xml:id="percent"/>
    <type xml:id="sport"/>
    <type xml:id="animal"/>
    <type xml:id="misc"/>
</types>
<units>
    <unit xml:id="dollar" n="1"/>
    <unit xml:id="mDollar" n="1000000"/>
    <unit xml:id="time" hr="1"/>
    <unit xml:id="dTime" hr="24"/>
    <unit xml:id="yTime" yr="1"/>
</units>

Reusing element and attribute names

White space in Relax NG