| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="expat-errors.html" /> |
| 13 | <link rel="prev" href="expat-example.html" /> |
| 14 | <link rel="parent" href="module-xml.parsers.expat.html" /> |
| 15 | <link rel="next" href="expat-errors.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>13.5.4 Content Model Descriptions </title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="13.5.3 Example" |
| 25 | href="expat-example.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="13.5 xml.parsers.expat " |
| 28 | href="module-xml.parsers.expat.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="13.5.5 Expat error constants" |
| 31 | href="expat-errors.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python Library Reference</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="expat-example.html">13.5.3 Example</A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="module-xml.parsers.expat.html">13.5 xml.parsers.expat </A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="expat-errors.html">13.5.5 Expat error constants</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H2><A NAME="SECTION0015540000000000000000"></A><A NAME="expat-content-models"></A> |
| 56 | <BR> |
| 57 | 13.5.4 Content Model Descriptions |
| 58 | </H2> |
| 59 | |
| 60 | <P> |
| 61 | Content modules are described using nested tuples. Each tuple |
| 62 | contains four values: the type, the quantifier, the name, and a tuple |
| 63 | of children. Children are simply additional content module |
| 64 | descriptions. |
| 65 | |
| 66 | <P> |
| 67 | The values of the first two fields are constants defined in the |
| 68 | <code>model</code> object of the <tt class="module">xml.parsers.expat</tt> module. These |
| 69 | constants can be collected in two groups: the model type group and the |
| 70 | quantifier group. |
| 71 | |
| 72 | <P> |
| 73 | The constants in the model type group are: |
| 74 | |
| 75 | <P> |
| 76 | <dl><dt><b><tt>XML_CTYPE_ANY</tt></b></dt> |
| 77 | <dd> |
| 78 | The element named by the model name was declared to have a content |
| 79 | model of <code>ANY</code>. |
| 80 | </dd></dl> |
| 81 | |
| 82 | <P> |
| 83 | <dl><dt><b><tt>XML_CTYPE_CHOICE</tt></b></dt> |
| 84 | <dd> |
| 85 | The named element allows a choice from a number of options; this is |
| 86 | used for content models such as <code>(A | B | C)</code>. |
| 87 | </dd></dl> |
| 88 | |
| 89 | <P> |
| 90 | <dl><dt><b><tt>XML_CTYPE_EMPTY</tt></b></dt> |
| 91 | <dd> |
| 92 | Elements which are declared to be <code>EMPTY</code> have this model type. |
| 93 | </dd></dl> |
| 94 | |
| 95 | <P> |
| 96 | <dl><dt><b><tt>XML_CTYPE_MIXED</tt></b></dt> |
| 97 | <dd> |
| 98 | </dd></dl> |
| 99 | |
| 100 | <P> |
| 101 | <dl><dt><b><tt>XML_CTYPE_NAME</tt></b></dt> |
| 102 | <dd> |
| 103 | </dd></dl> |
| 104 | |
| 105 | <P> |
| 106 | <dl><dt><b><tt>XML_CTYPE_SEQ</tt></b></dt> |
| 107 | <dd> |
| 108 | Models which represent a series of models which follow one after the |
| 109 | other are indicated with this model type. This is used for models |
| 110 | such as <code>(A, B, C)</code>. |
| 111 | </dd></dl> |
| 112 | |
| 113 | <P> |
| 114 | The constants in the quantifier group are: |
| 115 | |
| 116 | <P> |
| 117 | <dl><dt><b><tt>XML_CQUANT_NONE</tt></b></dt> |
| 118 | <dd> |
| 119 | No modifier is given, so it can appear exactly once, as for <code>A</code>. |
| 120 | </dd></dl> |
| 121 | |
| 122 | <P> |
| 123 | <dl><dt><b><tt>XML_CQUANT_OPT</tt></b></dt> |
| 124 | <dd> |
| 125 | The model is optional: it can appear once or not at all, as for |
| 126 | <code>A?</code>. |
| 127 | </dd></dl> |
| 128 | |
| 129 | <P> |
| 130 | <dl><dt><b><tt>XML_CQUANT_PLUS</tt></b></dt> |
| 131 | <dd> |
| 132 | The model must occur one or more times (like <code>A+</code>). |
| 133 | </dd></dl> |
| 134 | |
| 135 | <P> |
| 136 | <dl><dt><b><tt>XML_CQUANT_REP</tt></b></dt> |
| 137 | <dd> |
| 138 | The model must occur zero or more times, as for <code>A*</code>. |
| 139 | </dd></dl> |
| 140 | |
| 141 | <P> |
| 142 | |
| 143 | <DIV CLASS="navigation"> |
| 144 | <div class='online-navigation'> |
| 145 | <p></p><hr /> |
| 146 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 147 | <tr> |
| 148 | <td class='online-navigation'><a rel="prev" title="13.5.3 Example" |
| 149 | href="expat-example.html"><img src='../icons/previous.png' |
| 150 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 151 | <td class='online-navigation'><a rel="parent" title="13.5 xml.parsers.expat " |
| 152 | href="module-xml.parsers.expat.html"><img src='../icons/up.png' |
| 153 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 154 | <td class='online-navigation'><a rel="next" title="13.5.5 Expat error constants" |
| 155 | href="expat-errors.html"><img src='../icons/next.png' |
| 156 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 157 | <td align="center" width="100%">Python Library Reference</td> |
| 158 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 159 | href="contents.html"><img src='../icons/contents.png' |
| 160 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 161 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 162 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 163 | <td class='online-navigation'><a rel="index" title="Index" |
| 164 | href="genindex.html"><img src='../icons/index.png' |
| 165 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 166 | </tr></table> |
| 167 | <div class='online-navigation'> |
| 168 | <b class="navlabel">Previous:</b> |
| 169 | <a class="sectref" rel="prev" href="expat-example.html">13.5.3 Example</A> |
| 170 | <b class="navlabel">Up:</b> |
| 171 | <a class="sectref" rel="parent" href="module-xml.parsers.expat.html">13.5 xml.parsers.expat </A> |
| 172 | <b class="navlabel">Next:</b> |
| 173 | <a class="sectref" rel="next" href="expat-errors.html">13.5.5 Expat error constants</A> |
| 174 | </div> |
| 175 | </div> |
| 176 | <hr /> |
| 177 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 178 | </DIV> |
| 179 | <!--End of Navigation Panel--> |
| 180 | <ADDRESS> |
| 181 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 182 | </ADDRESS> |
| 183 | </BODY> |
| 184 | </HTML> |