UNC-Libraries / jquery.xmleditor

jQuery based XML editor plugin.
153 stars 71 forks source link

Choice tag not working #15

Closed oaixnomis closed 10 years ago

oaixnomis commented 10 years ago

I read that a function to enforce choice tag several months ago, but it seems not working.... please see screen shot below. thanks!

screen shot 2014-04-28 at 1 22 44 am screen shot 2014-04-28 at 1 23 33 am

bbpennel commented 10 years ago

Turns out that while enforcement of choice is working, right now if no maxOccurs is specified on the choice then it mistakenly considers it to be unbounded instead of the correct default of 1. I can release a fix later today.

oaixnomis commented 10 years ago

hi, thanks for your reply. I have added maxOccurs on the choice tag, and I can see one of the tag has greyed out however another one still can be added. screen shot 2014-04-29 at 1 58 05 am

bbpennel commented 10 years ago

That's interesting, would you be willing to share your schema?

oaixnomis commented 10 years ago

please see as below, it's a slightly modified version from the htmlbook project (https://github.com/oreillymedia/HTMLBook):

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/1999/xhtml" targetNamespace="http://www.w3.org/1999/xhtml" elementFormDefault="qualified" attributeFormDefault="unqualified">

<xs:element name="html">
  <xs:complexType>
    <xs:sequence>
      <xs:element ref="head"/>
      <xs:element ref="body"/>
    </xs:sequence>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="head">
  <xs:complexType>
    <xs:sequence>
      <!-- Note that in order to produce a valid content model, title must be first -->
        <xs:element ref="title"/>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element ref="base"/>
          <xs:element ref="command"/>
          <xs:element ref="link"/>
          <xs:element ref="meta"/>
          <xs:element ref="script"/>
          <xs:element ref="style"/>
      </xs:choice>
    </xs:sequence>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="body">
  <xs:complexType>
    <xs:sequence>
      <xs:choice>
        <xs:element ref="h1" minOccurs="0"/>
        <xs:element name="header" minOccurs="0" type="bookmainheader"/>
      </xs:choice>
      <xs:element name="figure" minOccurs="0" type="coverfigure"/>
      <xs:choice maxOccurs="unbounded">
        <xs:element ref="nav"/>
        <xs:element name="section" type="bookmaindiv"/>
        <!-- Separate out parts, as they have specific child requirements -->
        <xs:element name="div" type="bookpart"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="data-type" use="required" fixed="book"/>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="title">
  <xs:complexType mixed="true">
    <xs:complexContent>
      <xs:extension base="empty_elem_global_attrs"/>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<!-- HTML5 spec requires either href attr, target attr, or both, (not possible to represent this in Schema).
     In HTMLBook, we are formally requiring href -->
<xs:element name="base">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="empty_elem_global_attrs">
        <xs:attribute name="href" type="xs:anyURI" use="required"/>
        <xs:attribute name="target" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="link">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="empty_elem_global_attrs">
        <xs:attribute name="href" type="xs:anyURI" use="required"/>
        <xs:attribute name="hreflang" type="xs:language"/>
        <xs:attribute name="media" type="xs:string"/>
        <xs:attribute name="ref" type="xs:NMTOKENS"/>
        <xs:attribute name="sizes" type="xs:NMTOKENS"/>
        <xs:attribute name="type" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<!-- For HTMLBook, all book metadata should be encapsulated in name-value pairs using @name and @content attrs, respectively.
     These two attrs are required on each element.
-->
<xs:element name="meta">
  <xs:complexType>
    <xs:complexContent mixed="true">
      <xs:extension base="empty_elem_global_attrs">
        <xs:attribute name="name" type="xs:string" use="required"/>
        <xs:attribute name="content" type="xs:string" use="required"/>
        <xs:attribute name="charset" type="xs:string"/>
        <xs:attribute name="http-equiv">
          <xs:simpleType>
            <xs:restriction base="xs:token">
              <xs:enumeration value="content-language"/>
              <xs:enumeration value="content-type"/>
              <xs:enumeration value="default-style"/>
              <xs:enumeration value="refresh"/>
              <xs:enumeration value="set-cookie"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

  <!-- Not supporting the "noscript" element in HTMLBook, as HTML5 spec states 
    "it has no effect in the XHTML syntax" (http://www.w3.org/TR/2011/WD-html5-20110525/scripting-1.html#the-noscript-element) -->
<!-- <xs:element name="noscript"> -->

<!-- In HTMLBook, not allowing JS content to be embedded directly in script tag, and are requiring a @src attr -->
<xs:element name="script">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="empty_elem_global_attrs">
        <xs:attribute name="src" type="xs:anyURI" use="required"/>
        <xs:attribute name="async">
          <xs:simpleType>
            <xs:restriction base="xs:token">
              <xs:pattern value="([Aa][Ss][Yy][Nn][Cc])?"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="defer">
          <xs:simpleType>
            <xs:restriction base="xs:token">
              <xs:pattern value="([Dd][Ee][Ff][Ee][Rr])?"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="type" type="xs:string"/>
        <xs:attribute name="charset" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="style">
  <xs:complexType mixed="true">
      <xs:attribute name="media" type="xs:string"/>
      <xs:attribute name="type" type="xs:string"/>
      <xs:attribute name="scoped">
        <xs:simpleType>
          <xs:restriction base="xs:token">
            <xs:pattern value="([Ss][Cc][Oo][Pp][Ee][Dd])?"></xs:pattern>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<!-- Block elements -->

<!-- For now, limit "address" to support only inline element children -->
<xs:element name="address" type="inlines_mml_and_svg"/>

<xs:element name="aside" type="sidebar"/>

<!-- Note, per HTML5 spec, the actual requirements are a choice between:
    * a @src attribute on <audio> elem and no <source> children
    * no @src attribute on <audio> elem and 1 or more <source> children
    But this logic is impossible to capture in Schema, so not going to enforce -->
<xs:element name="audio">
  <xs:complexType mixed="true">
    <xs:sequence>
      <xs:element ref="source" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="track" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attributeGroup ref="generalmediaattributes"/>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="blockquote">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="block_xor_inline_children">
        <xs:attribute name="cite" type="xs:anyURI"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element> 

<xs:element name="canvas">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="block_xor_inline_children">
        <xs:attribute name="width" type="positive_int"/>
        <xs:attribute name="height" type="positive_int"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="details">
  <xs:complexType mixed="true">
    <xs:sequence>
      <xs:element ref="summary" minOccurs="0" maxOccurs="1"/>
      <xs:choice>
        <xs:group ref="blockelements" minOccurs="0" maxOccurs="unbounded"/>
        <xs:group ref="inlineelements" minOccurs="0" maxOccurs="unbounded"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="open">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:pattern value="([Oo][Pp][Ee][Nn])?"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<!-- Two choices for div content model:
     1. Block children only, with an optional h1-h6 to start
     2. Inline children only, no heading
-->
<xs:element name="div">
  <xs:complexType mixed="true">
    <xs:choice>
      <!-- Option 1: Optional heading(s) followed by block elements -->
      <xs:sequence>
        <xs:group ref="headings" minOccurs="0" maxOccurs="unbounded"/>
        <xs:group ref="blockelements" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence>
      <!-- Option 2: inlines and text only -->
      <xs:group ref="inlineelements" minOccurs="0" maxOccurs="unbounded"/>
    </xs:choice>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="dl">
  <xs:complexType>
    <xs:sequence maxOccurs="unbounded">
      <xs:element ref="dt" minOccurs="1" maxOccurs="unbounded"/>
      <xs:element ref="dd" minOccurs="1" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="embed">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="empty_elem_global_attrs">
        <xs:attribute name="src" type="xs:anyURI"/>
        <xs:attribute name="type" type="xs:string"/>
        <xs:attribute name="width" type="xs:string"/>
        <xs:attribute name="height" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="fieldset">
  <xs:complexType mixed="true">
    <xs:sequence>
      <xs:element ref="legend" minOccurs="0" maxOccurs="1"/>
      <xs:choice>
        <xs:group ref="blockelements" minOccurs="0" maxOccurs="unbounded"/>
        <xs:group ref="inlineelements" minOccurs="0" maxOccurs="unbounded"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="disabled" type="disabled_boolean"/>    
    <xs:attribute name="name" type="xs:string"/>
    <xs:attribute name="form" type="xs:IDREF"/>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<!-- We're deviating from the HTML5 spec in that we're only allowing block elements inside figure,
     and we're requiring a caption (which can come at either beginning or end) -->
<xs:element name="figure">
  <xs:complexType>
    <xs:choice>
      <xs:sequence>
        <xs:element ref="figcaption"/>
        <xs:group ref="figure_elements" maxOccurs="unbounded"/>
      </xs:sequence>
      <xs:sequence>
        <xs:group ref="figure_elements" maxOccurs="unbounded"/>
        <xs:element ref="figcaption"/>
      </xs:sequence>
    </xs:choice>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<!-- Custom type for cover figures; no caption -->
<xs:complexType name="coverfigure">
  <xs:group ref="figure_elements" maxOccurs="unbounded"/>
  <xs:attribute name="data-type" fixed="cover" use="required"/>
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<xs:element name="form">
  <xs:complexType>
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <!-- All block elements, except "form"; yes, I'm reproducing the list here, rather than split up the
           "blockelements" group -->
      <xs:element ref="address"/>
      <xs:element ref="aside"/>
      <xs:element ref="audio"/>
      <xs:element ref="blockquote"/>
      <xs:element ref="canvas"/>
      <xs:element ref="details"/>
      <xs:element ref="div"/>
      <xs:element ref="dl"/>
      <xs:element ref="embed"/>
      <xs:element ref="fieldset"/>
      <xs:element ref="figure"/>
      <xs:element ref="hr"/>
      <xs:element ref="iframe"/>
      <xs:element ref="map"/>

      <xs:element ref="menu"/>
      <xs:element ref="object"/>
      <xs:element ref="ol"/>
      <xs:element ref="p"/>
      <xs:element ref="pre"/>

      <xs:element ref="table"/>
      <xs:element ref="ul"/>
      <xs:element ref="video"/>
    </xs:choice>
    <xs:attribute name="accept-charset" type="xs:NMTOKENS"/>
    <xs:attribute name="action">
      <xs:simpleType>
        <xs:restriction base="xs:anyURI">
          <xs:minLength value="1"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="autocomplete" type="on_off"/>
    <xs:attribute name="enctype" type="enctype_formenctype"/>    
    <xs:attribute name="method" type="method_formmethod"/>    
    <!-- HTML5 also requires a form's name attribute to be unique among all other forms' name attributes,
         but skipping that requirement here -->
    <xs:attribute name="name">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:minLength value="1"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="novalidate">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:pattern value="([Nn][Oo][Vv][Aa][Ll][Ii][Dd][Aa][Tt][Ee])?"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="target" type="xs:string"/>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="hr" type="empty_elem_global_attrs"/>

<xs:element name="iframe">
  <xs:complexType mixed="true">
    <xs:group ref="inlineelements" minOccurs="0" maxOccurs="unbounded"/>
    <!-- Differing from HTML5 spec in that we're requiring a @src attribute here -->
    <xs:attribute name="src" use="required" type="xs:anyURI"/>
    <xs:attribute name="srcdoc" type="xs:string"/>
    <xs:attribute name="name" type="xs:string"/>
    <xs:attribute name="sandbox">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <!-- Ugly regex alert, because backreferences are not allowed in XML Schema -->
          <xs:pattern value="allow-(same-origin|top-navigation|forms|scripts)( allow-(same-origin|top-navigation|forms|scripts))*"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="seamless">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:pattern value="([Ss][Ee][Aa][Mm][Ll][Ee][Ss][Ss])?"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="width" type="xs:string"/>
    <xs:attribute name="height" type="xs:string"/>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<!-- Requiring block content model for "map" element for simplicity -->
<xs:element name="map">
  <xs:complexType>
    <xs:group ref="map_elements" minOccurs="0" maxOccurs="unbounded"/>
    <!-- Not enforcing two restrictions from HTML5 for name attribute: uniqueness against other name attributes on map, 
         and requirement that it match id value, if present -->
    <xs:attribute name="name" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <!-- nonempty and no spaces -->
          <xs:minLength value="1"/>
          <xs:pattern value="[^ ]*"></xs:pattern>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<!-- Not imposing any HTMLBook specific constraints on menu content; deferring to HTML5 spec -->
<xs:element name="menu">
  <xs:complexType>
    <xs:choice>
      <xs:element ref="li" maxOccurs="unbounded"/>
      <xs:choice>
        <xs:group ref="blockelements" minOccurs="0" maxOccurs="unbounded"/>
        <xs:group ref="inlineelements" minOccurs="0" maxOccurs="unbounded"/>
      </xs:choice>
    </xs:choice>
    <xs:attribute name="type">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="context"/>
          <xs:enumeration value="toolbar"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="label" type="xs:string"/>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<!--Follows the EPUB 3 spec for nav elements; see http://www.idpf.org/epub/30/spec/epub30-contentdocs.html#sec-xhtml-nav -->
<xs:element name="nav">
  <xs:complexType>
    <xs:sequence>
      <xs:group ref="headings" minOccurs="0"/>
      <xs:element name="ol" type="nav_doc_ol" minOccurs="0"/>
    </xs:sequence>
    <xs:attribute name="data-type" use="required" fixed="toc"/>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="object">
  <xs:complexType mixed="true">
    <xs:sequence>
      <xs:element ref="param" minOccurs="0" maxOccurs="1"/>
      <xs:choice>
        <xs:group ref="blockelements" minOccurs="0" maxOccurs="unbounded"/>
        <xs:group ref="inlineelements" minOccurs="0" maxOccurs="unbounded"/>
      </xs:choice>
    </xs:sequence>
    <xs:attribute name="data">
      <xs:simpleType>
        <xs:restriction base="xs:anyURI">
          <xs:minLength value="1"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="type" type="xs:string"/>
    <xs:attribute name="name" type="xs:string"/>
    <xs:attribute name="usemap" type="hash_name"/>    
    <!-- form attribute must refer to ID of a <form> element, but we're just checking that it's an IDREF -->
    <xs:attribute name="form" type="xs:IDREF"/>
    <xs:attribute name="width" type="xs:string"/>
    <xs:attribute name="height" type="xs:string"/>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="ol">
  <xs:complexType>
    <xs:sequence>
      <!-- "li"s in an "ol" can have a value attribute -->
      <xs:element name="li" minOccurs="0" maxOccurs="unbounded">
        <xs:complexType>
          <xs:complexContent>
            <xs:extension base="block_xor_inline_children">
              <xs:attribute name="value" type="positive_int"/>
            </xs:extension>
          </xs:complexContent>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attributeGroup ref="ol_attrs"/>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="p" type="inlines_mml_and_svg"/>

<xs:element name="pre">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="inlines_mml_and_svg">
        <xs:attribute name="data-code-language" type="xs:token"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<!-- Default global version of "section" element is for chapter-level book divisions
     (allows for modularization of HTML files at the chapter level),
     but see other complex types below for content models for lower-level sections --> 
<xs:element name="section" type="bookmaindiv"/>

<xs:element name="table">
  <xs:complexType>
    <xs:sequence>
      <xs:element ref="caption" minOccurs="0"/>
      <xs:element ref="colgroup" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="thead" minOccurs="0"/>
      <xs:choice>
        <xs:element ref="tbody" minOccurs="0" maxOccurs="unbounded"/>
        <xs:element ref="tr" maxOccurs="unbounded"/>
      </xs:choice>
      <!-- In order to simplify and ensure determinist content model, departing from the HTML5 spec
           and requiring tfoot to come at end of table, which is more intuitive anyway -->
      <xs:element ref="tfoot" minOccurs="0"/>
    </xs:sequence>
    <xs:attribute name="border">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <!-- Per HTML5 spec, we're accepting either the value 1 or an empty string here -->
          <xs:pattern value="1?"></xs:pattern>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="ul">
  <xs:complexType>
    <xs:sequence>
      <xs:element ref="li" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="video">
  <xs:complexType mixed="true">
    <xs:sequence>
      <xs:element ref="source" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="track" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attributeGroup ref="videomediaattributes"/>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<!-- Inline elements -->

<!-- Open question: allow block content within an <a>? Right now, restricting only to inline elements -->   
<xs:element name="a">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="inlines_mml_and_svg">
        <!-- ToDo: Any further attribute restrictions -->
        <xs:attribute name="href" type="xs:anyURI"/>
        <xs:attribute name="hreflang" type="xs:language"/>
        <xs:attribute name="rel" type="xs:NMTOKENS"/>
        <xs:attribute name="target" type="xs:string"/>
        <xs:attribute name="type" type="xs:string"/>
        <!-- The following attributes are for indexterms -->
        <xs:attribute name="data-primary" type="xs:string"/>
        <xs:attribute name="data-secondary" type="xs:string"/>
        <xs:attribute name="data-tertiary" type="xs:string"/>
        <xs:attribute name="data-see" type="xs:string"/>
        <xs:attribute name="data-seealso" type="xs:string"/>
        <xs:attribute name="data-sortas" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="abbr" type="inlines_mml_and_svg"/>

<xs:element name="b" type="inlines_mml_and_svg"/>

<xs:element name="bdi" type="inlines_mml_and_svg"/>

<xs:element name="bdo">
  <xs:complexType  mixed="true">
    <xs:sequence>
      <xs:group ref="inlines_plus_mml_and_svg" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <!-- Adding the dir attribute here instead of specifying it in the "globals" attribute group
         to modify to include use="required" --> 
    <xs:attribute name="dir" use="required">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="ltr"/>
          <xs:enumeration value="rtl"/>              
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attributeGroup ref="globals_minus_dir"/>
  </xs:complexType>
</xs:element>

<xs:element name="br" type="empty_elem_global_attrs"/>

<xs:element name="button">
  <!-- button elements can have any inline children, excluding other interactive elements -->
  <xs:complexType mixed="true">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element ref="a"/>
      <xs:element ref="abbr"/>
      <xs:element ref="b"/>
      <xs:element ref="bdi"/>
      <xs:element ref="bdo"/>
      <xs:element ref="br"/>
      <xs:element ref="cite"/>
      <xs:element ref="code"/>
      <xs:element ref="del"/>
      <xs:element ref="dfn"/>
      <xs:element ref="em"/>
      <xs:element ref="i"/>
      <xs:element ref="img"/>
      <xs:element ref="ins"/>
      <xs:element ref="kbd"/> 
      <xs:element ref="mark"/>  
      <xs:element ref="meter"/>
      <xs:element ref="output"/>
      <xs:element ref="progress"/>
      <xs:element ref="q"/>
      <xs:element ref="ruby"/>
      <xs:element ref="s"/>
      <xs:element ref="samp"/>
      <xs:element ref="small"/>
      <xs:element ref="span"/>
      <xs:element ref="strong"/>
      <xs:element ref="sub"/>
      <xs:element ref="sup"/>
      <xs:element ref="time"/>
      <xs:element ref="u"/>
      <xs:element ref="var"/>
      <xs:element ref="wbr"/>
    </xs:choice>
    <xs:attribute name="autofocus" type="autofocus_boolean"/>    
    <xs:attribute name="disabled" type="disabled_boolean"/>    
    <!-- form attribute must refer to ID of a <form> element, but we're just checking that it's an IDREF -->
    <xs:attribute name="form" type="xs:IDREF"/>
    <xs:attribute name="formaction">
      <xs:simpleType>
        <xs:restriction base="xs:anyURI">
          <xs:minLength value="1"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="formenctype" type="enctype_formenctype"/>    
    <xs:attribute name="formmethod" type="method_formmethod"/>    
    <xs:attribute name="formnovalidate" type="formnovalidate_boolean"/>    
    <xs:attribute name="formtarget" type="xs:string"/>
    <xs:attribute name="name" type="xs:string"/>
    <xs:attribute name="type">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="submit"/>
          <xs:enumeration value="reset"/>
          <xs:enumeration value="button"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="value" type="xs:string"/>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="cite" type="inlines_mml_and_svg"/>

<!-- Can also be used in document head -->
<xs:element name="command">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="empty_elem_global_attrs">
        <xs:attribute name="type">
          <xs:simpleType>
            <xs:restriction base="xs:token">
              <xs:enumeration value="command"/>
              <xs:enumeration value="checkbox"/>
              <xs:enumeration value="radio"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="label" use="required">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:minLength value="1"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="icon" type="xs:anyURI"/>
        <xs:attribute name="disabled" type="disabled_boolean"/>        
        <xs:attribute name="checked" type="checked_boolean"/>        
        <!-- In HTML5 spec, "radio" attribute can only be enabled for type="radio", but can't enforce that in Schema -->
        <xs:attribute name="radiogroup" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="code" type="inlines_mml_and_svg"/>

<xs:element name="datalist">
  <xs:complexType>
    <xs:choice>
      <xs:group ref="inlineelements" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="option" minOccurs="0" maxOccurs="unbounded"/>
    </xs:choice>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<!-- To simplify content model, "del" element is only allowed in inline contexts in HTMLBook -->
<xs:element name="del">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="inlines_mml_and_svg">
        <xs:attribute name="cite" type="xs:anyURI"/>
        <xs:attribute name="datetime" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="dfn">
  <!-- dfn elements can have any inline children, excluding another "dfn" element -->
  <xs:complexType mixed="true">
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <!-- Yeah we're enumerating all the inline options (from "inlineelements") here minus dfn, as there's no way to exclude just one item for a group,
             and I don't want to break up the "inlineelements" group below-->
        <xs:element ref="a"/>
        <xs:element ref="abbr"/>
        <xs:element ref="b"/>
        <xs:element ref="bdi"/>
        <xs:element ref="bdo"/>
        <xs:element ref="br"/>
        <xs:element ref="button"/>
        <xs:element ref="command"/>
        <xs:element ref="cite"/>
        <xs:element ref="code"/>
        <xs:element ref="datalist"/>
        <xs:element ref="del"/>
        <xs:element ref="em"/>
        <xs:element ref="i"/>
        <xs:element ref="img"/>
        <xs:element ref="input"/>
        <xs:element ref="ins"/>
        <xs:element ref="kbd"/>
        <xs:element ref="keygen"/>  
        <xs:element ref="label"/>  
        <xs:element ref="mark"/>  
        <xs:element ref="meter"/>
        <xs:element ref="output"/>
        <xs:element ref="progress"/>
        <xs:element ref="q"/>
        <xs:element ref="ruby"/>
        <xs:element ref="s"/>
        <xs:element ref="samp"/>
        <xs:element ref="select"/>
        <xs:element ref="small"/>
        <xs:element ref="span"/>
        <xs:element ref="strong"/>
        <xs:element ref="sub"/>
        <xs:element ref="sup"/>
        <xs:element ref="textarea"/>
        <xs:element ref="time"/>
        <xs:element ref="u"/>
        <xs:element ref="var"/>
        <xs:element ref="wbr"/>

      </xs:choice>
      <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="em" type="inlines_mml_and_svg"/>

<xs:element name="i" type="inlines_mml_and_svg"/>

<xs:element name="img">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="empty_elem_global_attrs">
        <xs:attribute name="alt" type="xs:string"/>
        <xs:attribute name="usemap" type="hash_name"/>
        <!-- In HTML5 spec, "ismap" attr requires that img have an "a" ancestor with "href" attr, but we are not enforcing that restriction in Schema -->
        <xs:attribute name="ismap">
          <xs:simpleType>
            <xs:restriction base="xs:token">
              <xs:pattern value="([Ii][Ss][Mm][Aa][Pp])?"></xs:pattern>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="src" use="required" type="xs:anyURI"/>
        <xs:attribute name="width" type="xs:string"/>
        <xs:attribute name="height" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="input">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="empty_elem_global_attrs">
        <xs:attribute name="accept" type="xs:NMTOKENS"/>
        <xs:attribute name="alt" type="xs:string"/>
        <xs:attribute name="autocomplete" type="on_off"/>
        <xs:attribute name="autofocus" type="autofocus_boolean"/>
        <xs:attribute name="checked" type="checked_boolean"/>
        <xs:attribute name="dirname" type="xs:string"/>
        <xs:attribute name="disabled" type="disabled_boolean"/>
        <!-- form attribute must refer to ID of a <form> element, but we're just checking that it's an IDREF -->
        <xs:attribute name="form" type="xs:IDREF"/>
        <xs:attribute name="formaction" type="xs:anyURI"/>
        <xs:attribute name="formenctype" type="enctype_formenctype"/>
        <xs:attribute name="formmethod" type="method_formmethod"/>
        <xs:attribute name="formnovalidate" type="formnovalidate_boolean"/>
        <xs:attribute name="formtarget" type="xs:string"/>
        <xs:attribute name="height" type="xs:string"/>
        <!-- "list" attr must refer to the id attr of a "datalist" element, but here we just check that it's an IDREF -->
        <xs:attribute name="list" type="xs:IDREF"/>
        <xs:attribute name="max" type="xs:string"/>
        <xs:attribute name="maxlength" type="positive_int"/>
        <xs:attribute name="min" type="xs:string"/>
        <xs:attribute name="multiple" type="multiple_boolean"/>        
        <xs:attribute name="name">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:minLength value="1"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="pattern" type="xs:string"/>
        <xs:attribute name="placeholder" type="xs:string"/>
        <xs:attribute name="readonly" type="readonly_boolean"/>        
        <xs:attribute name="required" type="required_boolean"/>        
        <xs:attribute name="size" type="positive_int"/>
        <xs:attribute name="src" type="xs:anyURI"/>
        <xs:attribute name="step">
          <xs:simpleType>
            <xs:restriction base="xs:float">
              <xs:minExclusive value="0"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="type">
          <xs:simpleType>
            <xs:restriction base="xs:token">
              <xs:enumeration value="hidden"/>
              <xs:enumeration value="text"/>
              <xs:enumeration value="search"/>
              <xs:enumeration value="tel"/>
              <xs:enumeration value="url"/>
              <xs:enumeration value="email"/>
              <xs:enumeration value="password"/>
              <xs:enumeration value="datetime"/>
              <xs:enumeration value="date"/>
              <xs:enumeration value="month"/>
              <xs:enumeration value="week"/>
              <xs:enumeration value="time"/>
              <xs:enumeration value="datetime-local"/>
              <xs:enumeration value="number"/>
              <xs:enumeration value="range"/>
              <xs:enumeration value="color"/>
              <xs:enumeration value="checkbox"/>
              <xs:enumeration value="radio"/>
              <xs:enumeration value="file"/>
              <xs:enumeration value="submit"/>
              <xs:enumeration value="image"/>
              <xs:enumeration value="reset"/>
              <xs:enumeration value="button"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="value" type="xs:string"/>
        <xs:attribute name="width" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<!-- To simplify content model, "ins" element is only allowed in inline contexts in HTMLBook -->
<xs:element name="ins">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="inlines_mml_and_svg">
        <xs:attribute name="cite" type="xs:anyURI"/>
        <xs:attribute name="datetime" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="kbd" type="inlines_mml_and_svg"/>

<xs:element name="keygen">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="empty_elem_global_attrs">
        <xs:attribute name="autofocus" type="autofocus_boolean"/>
        <xs:attribute name="challenge" type="xs:string"/>
        <xs:attribute name="disabled" type="disabled_boolean"/>
        <!-- form attribute must refer to ID of a <form> element, but we're just checking that it's an IDREF -->
        <xs:attribute name="form" type="xs:IDREF"/>
        <xs:attribute name="keytype">
          <xs:simpleType>
            <xs:restriction base="xs:token">
              <!-- HTML5 spec indicates just one enumerated value -->
              <xs:enumeration value="rsa"/>
            </xs:restriction>
          </xs:simpleType>  
        </xs:attribute>
        <xs:attribute name="name" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="label">
  <!-- label elements can have any inline children, excluding another "label" element -->
  <xs:complexType mixed="true">
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <!-- Yeah we're enumerating all the inline options (from "inlineelements") here minus label, as there's no way to exclude just one item for a group,
             and I don't want to break up the "inlineelements" group below-->
        <xs:element ref="a"/>
        <xs:element ref="abbr"/>
        <xs:element ref="b"/>
        <xs:element ref="bdi"/>
        <xs:element ref="bdo"/>
        <xs:element ref="br"/>
        <xs:element ref="button"/>
        <xs:element ref="command"/>
        <xs:element ref="cite"/>
        <xs:element ref="code"/>
        <xs:element ref="datalist"/>
        <xs:element ref="del"/>
        <xs:element ref="dfn"/>
        <xs:element ref="em"/>
        <xs:element ref="i"/>
        <xs:element ref="img"/>
        <xs:element ref="input"/>
        <xs:element ref="ins"/>
        <xs:element ref="kbd"/>
        <xs:element ref="keygen"/>
        <xs:element ref="mark"/>  
        <xs:element ref="meter"/>
        <xs:element ref="output"/>
        <xs:element ref="progress"/>
        <xs:element ref="q"/>
        <xs:element ref="ruby"/>
        <xs:element ref="s"/>
        <xs:element ref="samp"/>
        <xs:element ref="select"/>
        <xs:element ref="small"/>
        <xs:element ref="span"/>
        <xs:element ref="strong"/>
        <xs:element ref="sub"/>
        <xs:element ref="sup"/>
        <xs:element ref="textarea"/>
        <xs:element ref="time"/>
        <xs:element ref="u"/>
        <xs:element ref="var"/>
        <xs:element ref="wbr"/>

      </xs:choice>
      <xs:attribute name="for" type="xs:IDREF"/>
      <xs:attribute name="form" type="xs:IDREF"/>
      <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="mark" type="inlines_mml_and_svg"/>

<xs:element name="meter">
  <!-- meter elements can have any inline children, excluding another "meter" element -->
  <xs:complexType mixed="true">
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <!-- Yeah we're enumerating all the inline options (from "inlineelements") here minus meter, as there's no way to exclude just one item for a group,
             and I don't want to break up the "inlineelements" group below-->
        <xs:element ref="a"/>
        <xs:element ref="abbr"/>
        <xs:element ref="b"/>
        <xs:element ref="bdi"/>
        <xs:element ref="bdo"/>
        <xs:element ref="br"/>
        <xs:element ref="button"/>
        <xs:element ref="command"/>
        <xs:element ref="cite"/>
        <xs:element ref="code"/>
        <xs:element ref="datalist"/>
        <xs:element ref="del"/>
        <xs:element ref="dfn"/>
        <xs:element ref="em"/>
        <xs:element ref="i"/>
        <xs:element ref="img"/>
        <xs:element ref="input"/>
        <xs:element ref="ins"/>
        <xs:element ref="label"/>
        <xs:element ref="kbd"/>
        <xs:element ref="keygen"/>
        <xs:element ref="mark"/>
        <xs:element ref="output"/>
        <xs:element ref="progress"/>
        <xs:element ref="q"/>
        <xs:element ref="ruby"/>
        <xs:element ref="s"/>
        <xs:element ref="samp"/>
        <xs:element ref="select"/>
        <xs:element ref="small"/>
        <xs:element ref="span"/>
        <xs:element ref="strong"/>
        <xs:element ref="sub"/>
        <xs:element ref="sup"/>
        <xs:element ref="textarea"/>
        <xs:element ref="time"/>
        <xs:element ref="u"/>
        <xs:element ref="var"/>
        <xs:element ref="wbr"/>

      </xs:choice>
      <xs:attribute name="form" type="xs:IDREF"/>
      <xs:attribute name="high" type="xs:float"/>
      <xs:attribute name="low" type="xs:float"/>
      <xs:attribute name="max" type="xs:float"/>
      <xs:attribute name="min" type="xs:float"/>
      <xs:attribute name="optimum" type="xs:float"/>
      <xs:attribute name="value" type="xs:float"/>
      <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="output">
  <xs:complexType mixed="true">
    <xs:complexContent>
      <xs:extension base="inlines_mml_and_svg">
        <!-- output element has a few additional attributes -->
        <xs:attribute name="for" type="xs:IDREF"/>
        <xs:attribute name="form" type="xs:IDREF"/>
        <xs:attribute name="name" type="nonemptystring"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="progress">
  <!-- progress elements can have any inline children, excluding another "progress" element -->
  <xs:complexType mixed="true">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <!-- Yeah we're enumerating all the inline options (from "inlineelements") here minus progress, as there's no way to exclude just one item for a group,
           and I don't want to break up the "inlineelements" group below-->
      <xs:element ref="a"/>
      <xs:element ref="abbr"/>
      <xs:element ref="b"/>
      <xs:element ref="bdi"/>
      <xs:element ref="bdo"/>
      <xs:element ref="br"/>
      <xs:element ref="button"/>
      <xs:element ref="command"/>
      <xs:element ref="cite"/>
      <xs:element ref="code"/>
      <xs:element ref="datalist"/>
      <xs:element ref="del"/>
      <xs:element ref="dfn"/>
      <xs:element ref="em"/>
      <xs:element ref="i"/>
      <xs:element ref="img"/>
      <xs:element ref="input"/>
      <xs:element ref="ins"/>
      <xs:element ref="label"/>
      <xs:element ref="kbd"/>
      <xs:element ref="keygen"/>
      <xs:element ref="mark"/>
      <xs:element ref="meter"/>
      <xs:element ref="output"/>
      <xs:element ref="q"/>
      <xs:element ref="ruby"/>
      <xs:element ref="s"/>
      <xs:element ref="samp"/>
      <xs:element ref="select"/>
      <xs:element ref="small"/>
      <xs:element ref="span"/>
      <xs:element ref="strong"/>
      <xs:element ref="sub"/>
      <xs:element ref="sup"/>
      <xs:element ref="textarea"/>
      <xs:element ref="time"/>
      <xs:element ref="u"/>
      <xs:element ref="var"/>
      <xs:element ref="wbr"/>

    </xs:choice>
    <xs:attribute name="form" type="xs:IDREF"/>
    <xs:attribute name="max" type="xs:float"/>
    <xs:attribute name="value" type="xs:float"/>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="q">
  <xs:complexType mixed="true">
    <xs:complexContent>
      <xs:extension base="inlines_mml_and_svg">
        <xs:attribute name="cite" type="xs:anyURI"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="ruby">
  <xs:complexType mixed="true">
    <xs:complexContent>
      <xs:extension base="inlines_mml_and_svg">
          <xs:choice>
            <xs:element ref="rt"/>
            <xs:sequence>
              <xs:element ref="rp"/>
              <xs:element ref="rt"/>
              <xs:element ref="rp"/>
            </xs:sequence>
          </xs:choice>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="s" type="inlines_mml_and_svg"/>

<xs:element name="samp" type="inlines_mml_and_svg"/>

<xs:element name="select">
  <xs:complexType>
    <xs:choice>
      <xs:element ref="option" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="optgroup" minOccurs="0" maxOccurs="unbounded"/>
    </xs:choice>
    <xs:attribute name="autofocus" type="autofocus_boolean"/>
    <xs:attribute name="disabled" type="disabled_boolean"/>
    <!-- form attribute must refer to ID of a <form> element, but we're just checking that it's an IDREF -->
    <xs:attribute name="form" type="xs:IDREF"/>
    <xs:attribute name="multiple" type="multiple_boolean"/>
    <xs:attribute name="name">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:minLength value="1"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="required" type="required_boolean"/>
    <xs:attribute name="size" type="positive_int"/>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="small" type="inlines_mml_and_svg"/>

<xs:element name="span" type="inlines_mml_and_svg"/>

<xs:element name="strong" type="inlines_mml_and_svg"/>

<xs:element name="sub" type="inlines_mml_and_svg"/>

<xs:element name="sup" type="inlines_mml_and_svg"/>

<xs:element name="textarea">
  <xs:complexType mixed="true">
    <xs:attribute name="autofocus" type="autofocus_boolean"/>
    <xs:attribute name="cols" type="positive_int"/>
    <xs:attribute name="dirname" type="xs:string"/>
    <xs:attribute name="disabled" type="disabled_boolean"/>
    <!-- form attribute must refer to ID of a <form> element, but we're just checking that it's an IDREF -->
    <xs:attribute name="form" type="xs:IDREF"/>
    <xs:attribute name="maxlength" type="positive_int"/>
    <xs:attribute name="name">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:minLength value="1"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="placeholder" type="xs:string"/>
    <xs:attribute name="readonly" type="readonly_boolean"/>
    <xs:attribute name="required" type="required_boolean"/>
    <xs:attribute name="rows" type="positive_int"/>
    <xs:attribute name="wrap">
      <xs:simpleType>
        <xs:restriction base="xs:token">
          <xs:enumeration value="soft"/>
          <xs:enumeration value="hard"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="time">
  <!-- time elements can have any inline children, excluding another "time" element -->
  <xs:complexType mixed="true">
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <!-- Yeah we're enumerating all the inline options (from "inlineelements") here minus time, as there's no way to exclude just one item for a group,
           and I don't want to break up the "inlineelements" group below-->
      <xs:element ref="a"/>
      <xs:element ref="abbr"/>
      <xs:element ref="b"/>
      <xs:element ref="bdi"/>
      <xs:element ref="bdo"/>
      <xs:element ref="br"/>
      <xs:element ref="button"/>
      <xs:element ref="command"/>
      <xs:element ref="cite"/>
      <xs:element ref="code"/>
      <xs:element ref="datalist"/>
      <xs:element ref="del"/>
      <xs:element ref="dfn"/>
      <xs:element ref="em"/>
      <xs:element ref="i"/>
      <xs:element ref="img"/>
      <xs:element ref="input"/>
      <xs:element ref="ins"/>
      <xs:element ref="label"/>
      <xs:element ref="kbd"/>
      <xs:element ref="keygen"/>
      <xs:element ref="mark"/>
      <xs:element ref="meter"/>
      <xs:element ref="output"/>
      <xs:element ref="progress"/>
      <xs:element ref="q"/>
      <xs:element ref="ruby"/>
      <xs:element ref="s"/>
      <xs:element ref="samp"/>
      <xs:element ref="select"/>
      <xs:element ref="small"/>
      <xs:element ref="span"/>
      <xs:element ref="strong"/>
      <xs:element ref="sub"/>
      <xs:element ref="sup"/>
      <xs:element ref="textarea"/>
      <xs:element ref="u"/>
      <xs:element ref="var"/>
      <xs:element ref="wbr"/>

    </xs:choice>
    <xs:attribute name="pubdate">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:pattern value="([Pp][Uu][Bb][Dd][Aa][Tt][Ee])?"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
    <xs:attribute name="datetime" type="xs:string"/>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="u" type="inlines_mml_and_svg"/>

<xs:element name="var" type="inlines_mml_and_svg"/>

<xs:element name="wbr" type="empty_elem_global_attrs"/>

<!-- Miscellaneous elements -->
<xs:element name="area">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="empty_elem_global_attrs">
        <xs:attribute name="alt" type="xs:string"/>
        <xs:attribute name="coords">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <!-- Regex for string of comma-separated numbers -->
              <!-- Yes, this'll match a string that ends in a comma,
                   but close enough for validation purposes, given that XML Schema doesn't support lookaheads -->
              <xs:pattern value="[0-9][0-9,]*"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="shape">
          <xs:simpleType>
            <xs:restriction base="xs:token">
              <xs:enumeration value="circle"/>
              <xs:enumeration value="circ"/>
              <xs:enumeration value="default"/>
              <xs:enumeration value="poly"/>
              <xs:enumeration value="polygon"/>
              <xs:enumeration value="rect"/>
              <xs:enumeration value="rectangle"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="href" type="xs:anyURI"/>
        <xs:attribute name="target" type="xs:string"/>
        <xs:attribute name="rel">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <!-- Ugly regex alert -->
              <xs:pattern value="(alternate|author|bookmark|external|help|icon|license|next|nofollow|noreferrer|pingback|prefetch|prev|search|sidebar|stylesheet|tag)( (alternate|author|bookmark|external|help|icon|license|next|nofollow|noreferrer|pingback|prefetch|prev|search|sidebar|stylesheet|tag))*"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="media" type="xs:string"/>
        <xs:attribute name="hreflang" type="xs:language"/>
        <xs:attribute name="type" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="caption" type="caption"/>

<xs:element name="col">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="empty_elem_global_attrs">
        <xs:attribute name="span" type="xs:int"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="colgroup">
  <!-- Technically, colgroup requires an either/or situation, where if there is a span attribute, there should be no <col> children.
       Not possible to represent this in XML Schema -->
  <xs:complexType>
    <xs:sequence>
      <xs:element ref="col" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="span" type="xs:int"/>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="dd" type="block_xor_inline_children"/>

<xs:element name="dt" type="inlines_mml_and_svg"/>

<xs:element name="figcaption" type="caption"/>

<xs:element name="legend" type="inlines_mml_and_svg"/>

<xs:element name="li" type="block_xor_inline_children"/>

<xs:element name="optgroup">
  <xs:complexType>
    <xs:sequence>
      <xs:element ref="option" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute name="disabled" type="disabled_boolean"/>
    <xs:attribute name="label" type="xs:string" use="required"/>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="option">
  <xs:complexType mixed="true">
    <xs:complexContent>
      <xs:extension base="empty_elem_global_attrs">
        <xs:attribute name="disabled" type="disabled_boolean"/>        
        <xs:attribute name="label" type="xs:string"/>
        <xs:attribute name="selected">
          <xs:simpleType>
            <xs:restriction base="xs:token">
              <xs:pattern value="([Ss][Ee][Ll][Ee][Cc][Tt][Ee][Dd])?"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="value" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="param">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="empty_elem_global_attrs">
        <xs:attribute name="name" type="xs:string" use="required"/>
        <xs:attribute name="value" type="xs:string" use="required"/>        
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="rp" type="inlines_mml_and_svg"/>

<xs:element name="rt" type="inlines_mml_and_svg"/>

<xs:element name="source">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="empty_elem_global_attrs">
        <xs:attribute name="media" type="xs:string"/>
        <xs:attribute name="src" type="xs:anyURI" use="required"/>
        <xs:attribute name="type" type="xs:string"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>  
</xs:element>

<xs:element name="summary" type="inlines_mml_and_svg"/>

<xs:element name="tbody" type="tablegrouping"/>

<xs:element name="td">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="block_xor_inline_children">
        <xs:attributeGroup ref="tablecellattributes"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="th">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="inlines_mml_and_svg">
        <xs:attributeGroup ref="tablecellattributes"/>
        <xs:attribute name="scope">
          <xs:simpleType>
            <xs:restriction base="xs:token">
              <xs:enumeration value="auto"/>
              <xs:enumeration value="col"/>
              <xs:enumeration value="colgroup"/>
              <xs:enumeration value="row"/>
              <xs:enumeration value="rowgroup"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<xs:element name="thead" type="tablegrouping"/>

<xs:element name="tfoot" type="tablegrouping"/>

<xs:element name="tr">
  <xs:complexType>
    <xs:choice>
      <xs:element ref="td" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element ref="th" minOccurs="0" maxOccurs="unbounded"/>
    </xs:choice>
    <xs:attributeGroup ref="globals"/>
  </xs:complexType>
</xs:element>

<xs:element name="track">
  <xs:complexType>
    <xs:complexContent>
      <xs:extension base="empty_elem_global_attrs">
        <xs:attribute name="default">
          <xs:simpleType>
            <xs:restriction base="xs:token">
              <xs:pattern value="([Dd][Ee][Ff][Aa][Uu][Ll][Tt])?"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="kind">
          <xs:simpleType>
            <xs:restriction base="xs:token">
              <xs:enumeration value="captions"/>
              <xs:enumeration value="chapters"/>
              <xs:enumeration value="descriptions"/>
              <xs:enumeration value="metadata"/>
              <xs:enumeration value="subtitles"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
        <xs:attribute name="label" type="xs:string"/>
        <xs:attribute name="src" type="xs:anyURI"/>
        <xs:attribute name="srclang" type="xs:language"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>
</xs:element>

<!-- Heading elements -->
<xs:element name="h1" type="inlines_mml_and_svg"/>

<xs:element name="h2" type="inlines_mml_and_svg"/>

<xs:element name="h3" type="inlines_mml_and_svg"/>

<xs:element name="h4" type="inlines_mml_and_svg"/>

<xs:element name="h5" type="inlines_mml_and_svg"/>

<xs:element name="h6" type="inlines_mml_and_svg"/>

<!-- Global simple type definitions; see also global complex types section -->

<!-- For data-type attribute on book division <sections>, except part -->
<xs:simpleType name="bookmaindivtype">
  <xs:restriction base="xs:string">
    <xs:enumeration value="acknowledgments"/>
    <xs:enumeration value="afterword"/>
    <xs:enumeration value="appendix"/>
    <xs:enumeration value="bibliography"/>
    <xs:enumeration value="chapter"/>
    <xs:enumeration value="colophon"/>
    <xs:enumeration value="conclusion"/>
    <xs:enumeration value="copyright-page"/>
    <xs:enumeration value="dedication"/>
    <xs:enumeration value="foreword"/>
    <xs:enumeration value="glossary"/>
    <xs:enumeration value="halftitlepage"/>
    <xs:enumeration value="index"/>
    <xs:enumeration value="introduction"/>
    <xs:enumeration value="preface"/>
    <xs:enumeration value="titlepage"/>
    <xs:enumeration value="toc"/>
  </xs:restriction>
</xs:simpleType>

<!-- Used for attributes that require a nonempty string (e.g., "name" attribute on <output> -->
<xs:simpleType name="nonemptystring">
  <xs:restriction base="xs:string">
    <xs:pattern value=".+"/>
  </xs:restriction>
</xs:simpleType>

<!-- Used for positive integers -->
<xs:simpleType name="positive_int">
  <xs:restriction base="xs:integer">
    <xs:minExclusive value="0"/>
  </xs:restriction>
</xs:simpleType>

<!-- For types of subheadings: subtitle, author attributions, etc. -->
<!-- ToDo: Add additional types as required -->
<xs:simpleType name="subheadingtype">
  <xs:restriction base="xs:string">
    <xs:enumeration value="subtitle"/>
    <xs:enumeration value="author"/>
  </xs:restriction>
</xs:simpleType>

<!-- Restrict boolean type to only allow "true", "false", or empty string -->
<xs:simpleType name="true_false">
  <xs:restriction base="xs:token">
    <xs:enumeration value="true"/>
    <xs:enumeration value="false"/>
    <xs:enumeration value=""/>
  </xs:restriction>
</xs:simpleType>

<!-- For attributes enumerated as on/off (e.g., autocomplete) -->
<xs:simpleType name="on_off">
  <xs:restriction base="xs:token">
    <xs:enumeration value="on"/>
    <xs:enumeration value="off"/>
  </xs:restriction>
</xs:simpleType>

<!--- autofocus boolean -->
<xs:simpleType name="autofocus_boolean">
  <xs:restriction base="xs:token">
    <xs:pattern value="([Aa][Uu][Tt][Oo][Ff][Oo][Cc][Uu][Ss])?"/>
  </xs:restriction>
</xs:simpleType>

<!-- checked boolean -->
<xs:simpleType name="checked_boolean">
  <xs:restriction base="xs:token">
    <xs:pattern value="([Cc][Hh][Ee][Cc][Kk][Ee][Dd])?"/>
  </xs:restriction>
</xs:simpleType>

<!-- disabled boolean -->
<xs:simpleType name="disabled_boolean">
  <xs:restriction base="xs:token">
    <xs:pattern value="([Dd][Ii][Ss][Aa][Bb][Ll][Ee][Dd])?"/>
  </xs:restriction>
</xs:simpleType>

<!-- formnovalidate boolean -->
<xs:simpleType name="formnovalidate_boolean">
  <xs:restriction base="xs:token">
    <xs:pattern value="([Ff][Oo][Rr][Mm][Nn][Oo][Vv][Aa][Ll][Ii][Dd][Aa][Tt][Ee])?"></xs:pattern>
  </xs:restriction>
</xs:simpleType>

<!-- multiple boolean -->
<xs:simpleType name="multiple_boolean">
  <xs:restriction base="xs:token">
    <xs:pattern value="([Mm][Uu][Ll][Tt][Ii][Pp][Ll][Ee])?"></xs:pattern>
  </xs:restriction>
</xs:simpleType>

<!-- readonly boolean -->
<xs:simpleType name="readonly_boolean">
  <xs:restriction base="xs:token">
    <xs:pattern value="([Rr][Ee][Aa][Dd][Oo][Nn][Ll][Yy])?"></xs:pattern>
  </xs:restriction>
</xs:simpleType>

<!-- required boolean -->
<xs:simpleType name="required_boolean">
  <xs:restriction base="xs:token">
    <xs:pattern value="([Rr][Ee][Qq][Uu][Ii][Rr][Ee][Dd])?"/>
  </xs:restriction>
</xs:simpleType>  

<!-- for enctype/formenctype attributes used on form elements -->
<xs:simpleType name="enctype_formenctype">
  <xs:restriction base="xs:string">
    <xs:enumeration value="application/x-www-form-urlencoded"/>
    <xs:enumeration value="multipart/form-data"/>
    <xs:enumeration value="text/plain"/>
  </xs:restriction>
</xs:simpleType>

<!-- for method/formmethod attributes used on form elements -->
<xs:simpleType name="method_formmethod">
  <xs:restriction base="xs:token">
    <xs:enumeration value="get"/>
    <xs:enumeration value="post"/>
  </xs:restriction>
</xs:simpleType>

<!-- For hash-name references; we're just checking that string starts with #, not that the reference is actually there -->
<xs:simpleType name="hash_name">
  <xs:restriction base="xs:string">
    <xs:pattern value="#.+"/>
  </xs:restriction>
</xs:simpleType>

<!-- Global complex type definitions; see also global simple types section-->

<!-- Chapter/Appendix/Preface/etc. -->
<xs:complexType name="bookmaindiv">
  <xs:sequence>
    <xs:choice maxOccurs="1">
      <xs:element ref="h1"/>
      <xs:element name="header" type="bookmainheader"/>
    </xs:choice>
    <!-- Allow full set of block elements plus img elements in chapter-level sections -->
    <xs:group ref="figure_elements" minOccurs="0" maxOccurs="unbounded"/>
    <xs:element name="section" minOccurs="0" maxOccurs="unbounded" type="sect1"/>
  </xs:sequence>
  <!-- Note: special data-type attr restrictions here -->
  <xs:attribute name="data-type" use="required" type="bookmaindivtype"/>
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<!-- Parts -->
<xs:complexType name="bookpart">
  <xs:sequence>
    <xs:choice>
      <xs:element ref="h1"/>
      <xs:element name="header" type="bookmainheader"/>
    </xs:choice>
    <!-- Allow full set of block elements plus img elements in part divs -->
    <xs:group ref="figure_elements" minOccurs="0" maxOccurs="unbounded"/>
    <xs:element name="section" maxOccurs="unbounded" type="bookmaindiv"/>
  </xs:sequence>
  <!-- Note: special data-type attr restrictions here -->
  <xs:attribute name="data-type" use="required" fixed="part"/>
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<!-- Sect1s -->
<xs:complexType name="sect1">
  <xs:sequence>
    <xs:choice>
      <xs:element ref="h1"/>
      <xs:element name="header" type="bookmainheader"/>
    </xs:choice>
    <!-- Allow full set of block elements plus img elements in sect1s -->
    <xs:group ref="figure_elements" minOccurs="0" maxOccurs="unbounded"/>
    <xs:element name="section" minOccurs="0" maxOccurs="unbounded" type="sect2"/>
  </xs:sequence>
  <!-- Note: special data-type attr restrictions here -->
  <xs:attribute name="data-type" use="required" fixed="sect1"/>
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<!-- Sect2s -->
<xs:complexType name="sect2">
  <xs:sequence>
    <xs:choice>
      <xs:element ref="h2"/>
      <xs:element name="header" type="booksect2header"/>
    </xs:choice>
    <!-- Allow full set of block elements plus img elements in sect2s -->
    <xs:group ref="figure_elements" minOccurs="0" maxOccurs="unbounded"/>
    <xs:element name="section" minOccurs="0" maxOccurs="unbounded" type="sect3"/>
  </xs:sequence>
  <!-- Note: special data-type attr restrictions here -->
  <xs:attribute name="data-type" use="required" fixed="sect2"/>
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<!-- Sect3s -->
<xs:complexType name="sect3">
  <xs:sequence>
    <xs:choice>
      <xs:element ref="h3"/>
      <xs:element name="header" type="booksect3header"/>
    </xs:choice>
    <!-- Allow full set of block elements plus img elements in sect3s -->
    <xs:group ref="figure_elements" minOccurs="0" maxOccurs="unbounded"/>
    <xs:element name="section" minOccurs="0" maxOccurs="unbounded" type="sect4"/>
  </xs:sequence>
  <!-- Note: special data-type attr restrictions here -->
  <xs:attribute name="data-type" use="required" fixed="sect3"/>
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<!-- Sect4s -->
<xs:complexType name="sect4">
  <xs:sequence>
    <xs:choice>
      <xs:element ref="h4"/>
      <xs:element name="header" type="booksect4header"/>
    </xs:choice>
    <!-- Allow full set of block elements plus img elements in sect4s -->
    <xs:group ref="figure_elements" minOccurs="0" maxOccurs="unbounded"/>
    <xs:element name="section" minOccurs="0" maxOccurs="unbounded" type="sect5"/>
  </xs:sequence>
  <!-- Note: special data-type attr restrictions here -->
  <xs:attribute name="data-type" use="required" fixed="sect4"/>
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<!-- Sect5 -->
<xs:complexType name="sect5">
  <xs:sequence>
    <xs:choice>
      <xs:element ref="h5"/>
      <xs:element name="header" type="booksect5header"/>
    </xs:choice>
    <!-- Allow full set of block elements plus img elements in sect5s -->
    <xs:group ref="figure_elements" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
  <!-- Note: special data-type attr restrictions here -->
  <xs:attribute name="data-type" use="required" fixed="sect5"/>
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<!-- Sidebar; primarily for <aside> -->
<xs:complexType name="sidebar">
  <xs:sequence>
    <xs:element ref="h5" minOccurs="0"/> <!-- Unlike other sections, sidebar titles are optional -->
    <xs:group ref="figure_elements" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
  <!-- ToDo: require data-type attr restriction of "sidebar" here? -->
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<!-- Header blocks (used for title+subtitle) -->

<!-- Header for top-level blocks and top-level sections (part, chapter, sect1s) -->
<xs:complexType name="bookmainheader">
  <xs:sequence>
    <xs:element ref="h1"/>
    <xs:element name="p" type="subheading" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
</xs:complexType>

<!-- Header block for sect2s -->
<xs:complexType name="booksect2header">
  <xs:sequence>
    <xs:element ref="h2"/>
    <xs:element name="p" type="subheading" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
</xs:complexType>

<!-- Header block for sect3s -->
<xs:complexType name="booksect3header">
  <xs:sequence>
    <xs:element ref="h3"/>
    <xs:element name="p" type="subheading" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
</xs:complexType>

<!-- Header block for sect4s -->
<xs:complexType name="booksect4header">
  <xs:sequence>
    <xs:element ref="h4"/>
    <xs:element name="p" type="subheading" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
</xs:complexType>

<!-- Header block for sect5s -->
<xs:complexType name="booksect5header">
  <xs:sequence>
    <xs:element ref="h5"/>
    <xs:element name="p" type="subheading" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
</xs:complexType>

<!-- Subheadings: support subtitles, author attributions, etc. -->
<!-- ToDo: Continue to flesh out as necessary -->
<xs:complexType name="subheading" mixed="true">
  <xs:sequence>
    <xs:group ref="inlines_plus_mml_and_svg" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
  <!-- Note: special data-type attr restrictions here -->
  <xs:attribute name="data-type" use="required" type="subheadingtype"/>
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<!-- Custom types for Nav Document (following EPUB 3 spec; see http://www.idpf.org/epub/30/spec/epub30-contentdocs.html#sec-xhtml-nav) -->
<xs:complexType name="nav_doc_ol">
  <xs:sequence>
    <xs:element name="li" type="nav_doc_li" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
  <xs:attributeGroup ref="ol_attrs"/>
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<xs:complexType name="nav_doc_li" mixed="true">
  <xs:choice>
    <xs:element ref="span"/>
    <xs:sequence>
      <xs:element ref="a"/>
      <xs:element name="ol" minOccurs="0" type="nav_doc_ol"/>
    </xs:sequence>
  </xs:choice>
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<!-- General handling for elements that can accept only inline children -->
<xs:complexType name="inlines_mml_and_svg" mixed="true">
  <xs:sequence>
    <xs:group ref="inlines_plus_mml_and_svg" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<!-- General handling for elements that can accept either block children or inline children (not both)-->
<xs:complexType name="block_xor_inline_children" mixed="true">
  <xs:choice>
    <xs:group ref="blockelements" minOccurs="0" maxOccurs="unbounded"/>
    <xs:group ref="inlineelements" minOccurs="0" maxOccurs="unbounded"/>
  </xs:choice>
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<!-- Type for no restrictions on child content -->
<xs:complexType name="any_elems_attrs" mixed="true">
  <xs:sequence minOccurs="0" maxOccurs="unbounded">
    <xs:any processContents="lax"/>
  </xs:sequence>
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<!-- Type for empty element, with no specific attribute requirements -->
<xs:complexType name="empty_elem_global_attrs">
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<!-- Type for figure/table captions -->
<xs:complexType name="caption" mixed="true">
  <!-- Subset of block elements (<p>s or <div>s) xor inline elements-->
  <xs:choice>
    <xs:choice minOccurs="0" maxOccurs="unbounded">
      <xs:element ref="p"/>
      <xs:element ref="div"/>
    </xs:choice>
    <xs:group ref="inlines_plus_mml_and_svg" minOccurs="0" maxOccurs="unbounded"/>
  </xs:choice>
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<!-- Type for table group blocks: thead, tbody, and tfoot -->
<xs:complexType name="tablegrouping">
  <xs:sequence>
    <xs:element ref="tr" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
  <xs:attributeGroup ref="globals"/>
</xs:complexType>

<!-- Global groups -->

<xs:group name="blockelements">
  <!-- We're defining "block elements" here as a subset of HTML5 flow content that can be children of a <section> -->
  <xs:choice>
    <xs:element ref="address"/>
    <xs:element ref="aside"/>
    <xs:element ref="audio"/>
    <xs:element ref="blockquote"/>
    <xs:element ref="canvas"/>
    <xs:element ref="details"/>
    <xs:element ref="div"/>
    <xs:element ref="dl"/>
    <xs:element ref="embed"/>
    <xs:element ref="fieldset"/>
    <xs:element ref="figure"/>
    <xs:element ref="form"/>
    <xs:element ref="hr"/>
    <xs:element ref="iframe"/>
    <xs:element ref="map"/>
    <xs:element ref="menu"/>
    <xs:element ref="object"/>
    <xs:element ref="ol"/>
    <xs:element ref="p"/>
    <xs:element ref="pre"/>
    <xs:element ref="table"/>
    <xs:element ref="ul"/>
    <xs:element ref="video"/>
    <xs:group ref="external_elements"/>
  </xs:choice>
</xs:group>

<!-- Elements from other vocabularies that can be included in HTML5: MathML and SVG -->
<xs:group name="external_elements">
  <xs:choice>

  </xs:choice>
</xs:group>

<!-- Elements that can go in a figure = block elements + img -->
<xs:group name="figure_elements">
  <xs:choice>
    <xs:group ref="blockelements"/>
    <xs:element ref="img"/>
  </xs:choice>
</xs:group>

<!-- Elements that can go in a map = block elements + area -->
<xs:group name="map_elements">
  <xs:choice>
    <xs:group ref="blockelements"/>
    <xs:element ref="area"/>
  </xs:choice>
</xs:group>

<xs:group name="headings">
  <xs:choice>
    <xs:element ref="h1"/>
    <xs:element ref="h2"/>
    <xs:element ref="h3"/>
    <xs:element ref="h4"/>
    <xs:element ref="h5"/>
    <xs:element ref="h6"/>
  </xs:choice>
</xs:group>

<xs:group name="inlineelements">
<!-- We're defining "inline elements" here as being generally equivalent to the set of HTML5 phrasing elements: 
     those that can be children of a block element.
     These are elements that can be used *solely in an inline context* Elements that can be either inline or block 
     (e.g., <math> and <svg>) are not covered) -->
  <xs:choice>
    <xs:element ref="a"/>
    <xs:element ref="abbr"/>
    <xs:element ref="b"/>
    <xs:element ref="bdi"/>
    <xs:element ref="bdo"/>
    <xs:element ref="br"/>
    <xs:element ref="button"/>
    <xs:element ref="command"/>
    <xs:element ref="cite"/>
    <xs:element ref="code"/>
    <xs:element ref="datalist"/>
    <xs:element ref="del"/>
    <xs:element ref="dfn"/>
    <xs:element ref="em"/>
    <xs:element ref="i"/>
    <xs:element ref="input"/>
    <xs:element ref="img"/>
    <xs:element ref="ins"/>
    <xs:element ref="kbd"/>
    <xs:element ref="keygen"/>  
    <xs:element ref="label"/>  
    <xs:element ref="mark"/>  
    <xs:element ref="meter"/>
    <xs:element ref="output"/>
    <xs:element ref="progress"/>
    <xs:element ref="q"/>
    <xs:element ref="ruby"/>
    <xs:element ref="s"/>
    <xs:element ref="samp"/>
    <xs:element ref="select"/>
    <xs:element ref="small"/>
    <xs:element ref="span"/>
    <xs:element ref="strong"/>
    <xs:element ref="sub"/>
    <xs:element ref="sup"/>
    <xs:element ref="textarea"/>
    <xs:element ref="time"/>
    <xs:element ref="u"/>
    <xs:element ref="var"/>
    <xs:element ref="wbr"/>
  </xs:choice>
</xs:group>

<xs:group name="inlines_plus_mml_and_svg">
  <xs:choice>
    <xs:group ref="inlineelements"/>
    <xs:group ref="external_elements"/>
  </xs:choice>
</xs:group>

<!-- Global attribute groups -->
<!-- ToDo: Go ahead and add group for global HTML5 attributes (with exception of data- attrs),
      or just leave the xs:anyAttribute declarations to catch these? (If this is done, remove all the xs:attribute declarations for "id")-->

<!-- All globals except "dir", which is separated out because other elements have their own 'dir' requirements -->
<xs:attributeGroup name="globals_minus_dir">
  <xs:attribute name="accesskey">
    <xs:simpleType>
      <xs:restriction base="xs:NMTOKENS">
        <xs:pattern value="[^ ]( [^ ])*"></xs:pattern>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>
  <xs:attribute name="class" type="xs:NMTOKENS"/>
  <xs:attribute name="contenteditable" type="true_false"/>
  <xs:attribute name="contextmenu" type="xs:IDREF"/>
  <xs:attribute name="draggable" type="true_false"/>
  <xs:attribute name="dropzone" type="xs:NMTOKENS"/>
  <xs:attribute name="hidden">
    <xs:simpleType>
      <xs:restriction base="xs:token">
        <xs:pattern value="([Hh][Ii][Dd][Dd][Ee][Nn])?"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>
  <xs:attribute name="id" type="xs:ID"/>
  <xs:attribute name="lang" type="xs:language"/>
  <xs:attribute name="spellcheck" type="true_false"/>
  <xs:attribute name="style" type="xs:string"/>
  <xs:attribute name="tabindex" type="xs:integer"/>
  <xs:attribute name="title" type="xs:string"/>
  <!-- To accommodate data- attrs -->
  <xs:anyAttribute processContents="lax"/>
</xs:attributeGroup>

<!-- All globals, including dir -->
<xs:attributeGroup name="globals">
  <xs:attributeGroup ref="globals_minus_dir"/>
  <xs:attribute name="dir">
    <xs:simpleType>
      <xs:restriction base="xs:token">
        <xs:enumeration value="ltr"/>
        <xs:enumeration value="rtl"/>              
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>
</xs:attributeGroup>

<!-- Attributes used by <ol> elements -->
<xs:attributeGroup name="ol_attrs">
  <xs:attribute name="reversed">
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <!-- Must be a case-insensitive match for "reversed" or empty string -->
        <xs:pattern value="([Rr][Ee][Vv][Ee][Rr][Ss][Ee][Dd])?"/>            
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>
  <xs:attribute name="start" type="xs:integer"/>
  <xs:attribute name="type">
    <xs:simpleType>
      <xs:restriction base="xs:token">
        <xs:enumeration value="1"/>
        <xs:enumeration value="a"/>
        <xs:enumeration value="A"/>
        <xs:enumeration value="i"/>
        <xs:enumeration value="I"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>
</xs:attributeGroup>

<!-- Media attributes used by both <audio> and <video> elements -->
<xs:attributeGroup name="generalmediaattributes">
  <xs:attribute name="src" type="xs:anyURI"/>
  <xs:attribute name="preload">
    <xs:simpleType>
      <xs:restriction base="xs:token">
        <xs:enumeration value="auto"/>
        <xs:enumeration value="metadata"/>
        <xs:enumeration value="none"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>
  <xs:attribute name="autoplay">
    <xs:simpleType>
      <xs:restriction base="xs:token">
        <xs:pattern value="([Aa][Uu][Tt][Oo][Pp][Ll][Aa][Yy])?"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>
  <xs:attribute name="mediagroup" type="xs:string"/>
  <xs:attribute name="loop">
    <xs:simpleType>
      <xs:restriction base="xs:token">
        <xs:pattern value="([Ll][Oo][Oo][Pp])?"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>
  <xs:attribute name="muted">
    <xs:simpleType>
      <xs:restriction base="xs:token">
        <xs:pattern value="([Mm][Uu][Tt][Ee][Dd])?"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>
  <xs:attribute name="controls">
    <xs:simpleType>
      <xs:restriction base="xs:token">
        <xs:pattern value="([Cc][Oo][Nn][Tt][Rr][Oo][Ll][Ss])?"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>
</xs:attributeGroup>

<xs:attributeGroup name="videomediaattributes">
  <xs:attributeGroup ref="generalmediaattributes"/>
  <xs:attribute name="poster" type="xs:anyURI"/>
  <xs:attribute name="width" type="xs:string"/>
  <xs:attribute name="height" type="xs:string"/>
</xs:attributeGroup>

<!-- Table cell attributes shared by both th and td (does not include th-specific element scope) -->
<xs:attributeGroup name="tablecellattributes">
  <xs:attribute name="colspan" type="positive_int"/>
  <xs:attribute name="rowspan" type="positive_int"/>
  <!-- Per HTML5 spec, each space-separated token in "headers" should be an idref pointing to
       the id on a corresponding <th> in the same table, but not enforcing this in the Schema -->
  <xs:attribute name="headers" type="xs:NMTOKENS"/>
</xs:attributeGroup>

</xs:schema>
bbpennel commented 10 years ago

Thanks, I pushed a fix for this particular issue, although there is still plenty wrong/unimplemented with maxOccurs.

oaixnomis commented 10 years ago

it is working fine now~ thanks for the quick fix! have a nice day!