Changeset 180 for Xml/xsd-fu
- Timestamp:
- 05/29/08 18:12:08 (6 months ago)
- Location:
- Xml/xsd-fu/trunk/generateDS
- Files:
-
- 12 modified
-
Demos/People/people.xml (modified) (2 diffs)
-
Demos/Xmlbehavior/README (modified) (1 diff)
-
PKG-INFO (modified) (1 diff)
-
README (modified) (1 diff)
-
gends_user_methods.py (modified) (1 diff)
-
generateDS.html (modified) (53 diffs)
-
generateDS.py (modified) (66 diffs)
-
process_includes.py (modified) (6 diffs)
-
setup.py (modified) (1 diff)
-
tests/out1sub.py (modified) (1 diff)
-
tests/out1sup.py (modified) (27 diffs)
-
tests/people.xsd (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Xml/xsd-fu/trunk/generateDS/Demos/People/people.xml
r111 r180 26 26 <interest>cats</interest> 27 27 <interest>dogs</interest> 28 <imagesize>78</imagesize> 29 <imageproperty attrib1="abc <def> ghi">some pretty stuff</imageproperty> 28 30 <category>8</category> 29 31 <promoter> … … 40 42 <client> 41 43 <fullname>Arnold Applebee</fullname> 42 <refid>10001</refid> 44 <refid>10002</refid> 45 </client> 46 </promoter> 47 <promoter> 48 <client> 49 <fullname>Charlie Chuckles</fullname> 50 <refid>10003</refid> 43 51 </client> 44 52 </promoter> -
Xml/xsd-fu/trunk/generateDS/Demos/Xmlbehavior/README
r111 r180 15 15 1. Generate the super-class file: 16 16 17 python /generateDS.py -o po.py po.xsd17 python generateDS.py -o po.py po.xsd 18 18 19 19 2. Generate the sub-class including the methods described in -
Xml/xsd-fu/trunk/generateDS/PKG-INFO
r112 r180 1 1 Metadata-Version: 1.0 2 2 Name: generateDS 3 Version: 1.1 1a3 Version: 1.13a 4 4 Summary: Generation of Python data structures and XML parser from Xschema 5 5 Home-page: http://www.rexx.com/~dkuhlman -
Xml/xsd-fu/trunk/generateDS/README
r112 r180 140 140 Change history 141 141 -------------- 142 143 Version 1.13a (05/26/2008): 144 * Added support for generating namespace prefix during export 145 if the XML Schema specifies the targetNamespace. Thanks to 146 Andre Adrian for implementing this feature. 147 148 Version 1.12b (05/20/2008): 149 * Patches to escape special XML characters (entities) in valueOf 150 and attributes. Thanks to Darius Powell for this fix. 151 152 Version 1.12a (05/06/2008): 153 * Fix to name used to generate validation method. 154 * Embedded process_includes.py functionality into generateDS.py. 155 156 Version 1.11d (04/28/2008) 157 * Added support for specifying default values in attributes 158 and elements that are primitive types. 159 160 Version 1.11c (03/31/2008) 161 * A fix in enumeration building code. 162 163 Version 1.11b (11/19/2007) 164 * Fixed bug that caused an infinite loop when a class has a 165 simple type as a base/super class. 166 * Added additional simple types to the list of recognized simple 167 types. For a list of simple types, see: 168 http://www.w3.org/TR/xmlschema-0/#SimpleTypeFacets 169 * Added additional Python keywords to list of transformed names. 170 See global variable NameTable. 142 171 143 172 Version 1.11a (10/11/2007) -
Xml/xsd-fu/trunk/generateDS/gends_user_methods.py
r111 r180 90 90 method1 = MethodSpec(name='walk_and_update', 91 91 source='''\ 92 def walk_and_update(self , brackets):92 def walk_and_update(self): 93 93 members = %(class_name)s._member_data_items 94 94 for member in members: 95 95 obj1 = getattr(self, member.get_name()) 96 if member.get_data_type() == 'xs: string':97 newvalue = '%%s%%s%%s' %% (brackets[0], obj1, brackets[1],)96 if member.get_data_type() == 'xs:date': 97 newvalue = date_calcs.date_from_string(obj1) 98 98 setattr(self, member.get_name(), newvalue) 99 99 elif member.get_container(): 100 100 for child in obj1: 101 101 if type(child) == types.InstanceType: 102 child.walk_and_update( brackets)102 child.walk_and_update() 103 103 else: 104 104 obj1 = getattr(self, member.get_name()) 105 105 if type(obj1) == types.InstanceType: 106 obj1.walk_and_update(brackets) 106 obj1.walk_and_update() 107 if %(class_name)s.superclass != None: 108 %(class_name)s.superclass.walk_and_update(self) 107 109 ''', 108 110 # class_names=r'^Employee$|^[a-zA-Z]*Dependent$', -
Xml/xsd-fu/trunk/generateDS/generateDS.html
r112 r180 7 7 <title>generateDS -- Generate Data Structures from XML Schema</title> 8 8 <meta name="author" content="Dave Kuhlman" /> 9 <meta name="date" content=" Oct. 11, 2007" />9 <meta name="date" content="May 7, 2008" /> 10 10 <meta name="copyright" content="Copyright (c) 2004 Dave Kuhlman. This documentation and the software it describes is covered by The MIT License: http://www.opensource.org/licenses/mit-license." /> 11 11 <style type="text/css"> … … 192 192 </td></tr> 193 193 <tr><th class="docinfo-name">Revision:</th> 194 <td>1.1 1a</td></tr>194 <td>1.13a</td></tr> 195 195 <tr><th class="docinfo-name">Date:</th> 196 <td> Oct. 11, 2007</td></tr>196 <td>May 7, 2008</td></tr> 197 197 <tr><th class="docinfo-name">Copyright:</th> 198 198 <td>Copyright (c) 2004 Dave Kuhlman. This documentation … … 224 224 <li><a class="reference internal" href="#how-to-use-generateds-py" id="id11">4 How-to Use <tt class="docutils literal"><span class="pre">generateDS.py</span></tt></a><ul class="auto-toc"> 225 225 <li><a class="reference internal" href="#running-generateds-py" id="id12">4.1 Running <tt class="docutils literal"><span class="pre">generateDS.py</span></tt></a></li> 226 <li><a class="reference internal" href="#name-conf icts" id="id13">4.2 Name conficts</a><ul class="auto-toc">226 <li><a class="reference internal" href="#name-conflicts" id="id13">4.2 Name conflicts</a><ul class="auto-toc"> 227 227 <li><a class="reference internal" href="#conflicts-with-python-keywords" id="id14">4.2.1 Conflicts with Python keywords</a></li> 228 228 <li><a class="reference internal" href="#conflicts-between-child-elements-and-attributes" id="id15">4.2.2 Conflicts between child elements and attributes</a></li> 229 229 </ul> 230 230 </li> 231 <li><a class="reference internal" href="#supported-features-of-xml-schema" id="id16">4.3 Supported features of XML Schema</a><ul class="auto-toc"> 232 <li><a class="reference internal" href="#attributes-no-nested-children" id="id17">4.3.1 Attributes + no nested children</a></li> 233 <li><a class="reference internal" href="#mixed-content" id="id18">4.3.2 Mixed content</a></li> 234 <li><a class="reference internal" href="#anyattribute" id="id19">4.3.3 anyAttribute</a></li> 235 <li><a class="reference internal" href="#element-extensions" id="id20">4.3.4 Element extensions</a></li> 236 <li><a class="reference internal" href="#attribute-groups" id="id21">4.3.5 Attribute groups</a></li> 237 <li><a class="reference internal" href="#substitution-groups" id="id22">4.3.6 Substitution groups</a></li> 238 <li><a class="reference internal" href="#primitive-types" id="id23">4.3.7 Primitive types</a></li> 239 <li><a class="reference internal" href="#simpletype" id="id24">4.3.8 simpleType</a></li> 240 <li><a class="reference internal" href="#list-values-optional-values-maxoccurs-etc" id="id25">4.3.9 List values, optional values, maxOccurs, etc.</a></li> 241 <li><a class="reference internal" href="#simpletype-and-validators" id="id26">4.3.10 simpleType and validators</a></li> 242 </ul> 243 </li> 244 </ul> 245 </li> 246 <li><a class="reference internal" href="#the-xml-schema-input-to-generateds" id="id27">5 The XML Schema Input to generateDS</a><ul class="auto-toc"> 247 <li><a class="reference internal" href="#additional-constructions" id="id28">5.1 Additional constructions</a><ul class="auto-toc"> 248 <li><a class="reference internal" href="#complextype-at-top-level" id="id29">5.1.1 <complexType> at top-level</a></li> 249 <li><a class="reference internal" href="#use-of-ref-instead-of-name-and-type-attributes" id="id30">5.1.2 Use of "ref" instead of "name" and "type" attributes</a></li> 250 <li><a class="reference internal" href="#extension-types" id="id31">5.1.3 Extension types</a></li> 251 <li><a class="reference internal" href="#elements-containing-mixed-content" id="id32">5.1.4 Elements containing mixed content</a></li> 252 </ul> 253 </li> 254 </ul> 255 </li> 256 <li><a class="reference internal" href="#id1" id="id33">6 XMLBehaviors</a><ul class="auto-toc"> 257 <li><a class="reference internal" href="#the-xmlbehaviors-input-file" id="id34">6.1 The XMLBehaviors input file</a></li> 258 <li><a class="reference internal" href="#implementing-other-sources-for-implementation-bodies" id="id35">6.2 Implementing other sources for implementation bodies</a></li> 259 </ul> 260 </li> 261 <li><a class="reference internal" href="#additional-features" id="id36">7 Additional Features</a><ul class="auto-toc"> 262 <li><a class="reference internal" href="#xsd-list-element-support" id="id37">7.1 xsd:list element support</a></li> 263 <li><a class="reference internal" href="#xsd-enumeration-support" id="id38">7.2 xsd:enumeration support</a></li> 264 <li><a class="reference internal" href="#xsd-union-support" id="id39">7.3 xsd:union support</a></li> 265 <li><a class="reference internal" href="#extended-xsd-choice-support" id="id40">7.4 Extended xsd:choice support</a></li> 266 <li><a class="reference internal" href="#minoccurs-attribute-support" id="id41">7.5 minOccurs attribute support</a></li> 267 <li><a class="reference internal" href="#more-thorough-content-type-and-base-type-resolution" id="id42">7.6 More thorough content type and base type resolution</a></li> 268 <li><a class="reference internal" href="#making-top-level-simpletypes-available-from-xschemahandler" id="id43">7.7 Making top level simpleTypes available from XschemaHandler</a></li> 269 </ul> 270 </li> 271 <li><a class="reference internal" href="#how-to-use-the-generated-source-code" id="id44">8 How-to Use the Generated Source Code</a><ul class="auto-toc"> 272 <li><a class="reference internal" href="#the-parsing-functions" id="id45">8.1 The parsing functions</a></li> 273 <li><a class="reference internal" href="#the-export-methods" id="id46">8.2 The export methods</a><ul class="auto-toc"> 274 <li><a class="reference internal" href="#method-export" id="id47">8.2.1 Method export</a></li> 275 <li><a class="reference internal" href="#method-exportliteral" id="id48">8.2.2 Method <tt class="docutils literal"><span class="pre">exportLiteral</span></tt></a><ul class="auto-toc"> 276 <li><a class="reference internal" href="#what-it-does" id="id49">8.2.2.1 What It Does</a></li> 277 <li><a class="reference internal" href="#why-you-might-care" id="id50">8.2.2.2 Why You Might Care</a></li> 278 <li><a class="reference internal" href="#how-to-use-it" id="id51">8.2.2.3 How to use it</a></li> 279 </ul> 280 </li> 281 </ul> 282 </li> 283 <li><a class="reference internal" href="#building-instances" id="id52">8.3 Building instances</a></li> 284 <li><a class="reference internal" href="#using-the-subclass-module" id="id53">8.4 Using the subclass module</a></li> 285 <li><a class="reference internal" href="#elements-with-attributes-but-no-nested-children" id="id54">8.5 Elements with attributes but no nested children</a></li> 286 <li><a class="reference internal" href="#id3" id="id55">8.6 Mixed content</a></li> 287 <li><a class="reference internal" href="#id5" id="id56">8.7 anyAttribute</a></li> 288 <li><a class="reference internal" href="#user-methods" id="id57">8.8 User Methods</a></li> 289 </ul> 290 </li> 291 <li><a class="reference internal" href="#how-to-modify-the-generated-code" id="id58">9 How-to Modify the Generated Code</a><ul class="auto-toc"> 292 <li><a class="reference internal" href="#adding-features-to-class-definitions" id="id59">9.1 Adding features to class definitions</a></li> 293 </ul> 294 </li> 295 <li><a class="reference internal" href="#examples-and-demonstrations" id="id60">10 Examples and Demonstrations</a></li> 296 <li><a class="reference internal" href="#limitations-of-generateds" id="id61">11 Limitations of generateDS</a><ul class="auto-toc"> 297 <li><a class="reference internal" href="#xml-schema-limitations" id="id62">11.1 XML Schema limitations</a></li> 298 <li><a class="reference internal" href="#large-documents" id="id63">11.2 Large documents</a></li> 299 </ul> 300 </li> 301 <li><a class="reference internal" href="#includes-the-xml-schema-include-element" id="id64">12 Includes -- The XML Schema include element</a></li> 302 <li><a class="reference internal" href="#acknowledgment" id="id65">13 Acknowledgment</a></li> 303 <li><a class="reference internal" href="#see-also" id="id66">14 See Also</a></li> 231 </ul> 232 </li> 233 <li><a class="reference internal" href="#supported-features-of-xml-schema" id="id16">5 Supported features of XML Schema</a><ul class="auto-toc"> 234 <li><a class="reference internal" href="#attributes-no-nested-children" id="id17">5.1 Attributes + no nested children</a></li> 235 <li><a class="reference internal" href="#mixed-content" id="id18">5.2 Mixed content</a></li> 236 <li><a class="reference internal" href="#anyattribute" id="id19">5.3 anyAttribute</a></li> 237 <li><a class="reference internal" href="#element-extensions" id="id20">5.4 Element extensions</a></li> 238 <li><a class="reference internal" href="#attribute-groups" id="id21">5.5 Attribute groups</a></li> 239 <li><a class="reference internal" href="#substitution-groups" id="id22">5.6 Substitution groups</a></li> 240 <li><a class="reference internal" href="#primitive-types" id="id23">5.7 Primitive types</a></li> 241 <li><a class="reference internal" href="#simpletype" id="id24">5.8 simpleType</a></li> 242 <li><a class="reference internal" href="#list-values-optional-values-maxoccurs-etc" id="id25">5.9 List values, optional values, maxOccurs, etc.</a></li> 243 <li><a class="reference internal" href="#simpletype-and-validators" id="id26">5.10 simpleType and validators</a></li> 244 <li><a class="reference internal" href="#include-file-processing" id="id27">5.11 Include file processing</a></li> 245 </ul> 246 </li> 247 <li><a class="reference internal" href="#the-xml-schema-input-to-generateds" id="id28">6 The XML Schema Input to generateDS</a><ul class="auto-toc"> 248 <li><a class="reference internal" href="#additional-constructions" id="id29">6.1 Additional constructions</a><ul class="auto-toc"> 249 <li><a class="reference internal" href="#complextype-at-top-level" id="id30">6.1.1 <complexType> at top-level</a></li> 250 <li><a class="reference internal" href="#use-of-ref-instead-of-name-and-type-attributes" id="id31">6.1.2 Use of "ref" instead of "name" and "type" attributes</a></li> 251 <li><a class="reference internal" href="#extension-types" id="id32">6.1.3 Extension types</a></li> 252 <li><a class="reference internal" href="#elements-containing-mixed-content" id="id33">6.1.4 Elements containing mixed content</a></li> 253 </ul> 254 </li> 255 </ul> 256 </li> 257 <li><a class="reference internal" href="#id1" id="id34">7 XMLBehaviors</a><ul class="auto-toc"> 258 <li><a class="reference internal" href="#the-xmlbehaviors-input-file" id="id35">7.1 The XMLBehaviors input file</a></li> 259 <li><a class="reference internal" href="#implementing-other-sources-for-implementation-bodies" id="id36">7.2 Implementing other sources for implementation bodies</a></li> 260 </ul> 261 </li> 262 <li><a class="reference internal" href="#additional-features" id="id37">8 Additional Features</a><ul class="auto-toc"> 263 <li><a class="reference internal" href="#xsd-list-element-support" id="id38">8.1 xsd:list element support</a></li> 264 <li><a class="reference internal" href="#xsd-enumeration-support" id="id39">8.2 xsd:enumeration support</a></li> 265 <li><a class="reference internal" href="#xsd-union-support" id="id40">8.3 xsd:union support</a></li> 266 <li><a class="reference internal" href="#extended-xsd-choice-support" id="id41">8.4 Extended xsd:choice support</a></li> 267 <li><a class="reference internal" href="#minoccurs-attribute-support" id="id42">8.5 minOccurs attribute support</a></li> 268 <li><a class="reference internal" href="#more-thorough-content-type-and-base-type-resolution" id="id43">8.6 More thorough content type and base type resolution</a></li> 269 <li><a class="reference internal" href="#making-top-level-simpletypes-available-from-xschemahandler" id="id44">8.7 Making top level simpleTypes available from XschemaHandler</a></li> 270 </ul> 271 </li> 272 <li><a class="reference internal" href="#how-to-use-the-generated-source-code" id="id45">9 How-to Use the Generated Source Code</a><ul class="auto-toc"> 273 <li><a class="reference internal" href="#the-parsing-functions" id="id46">9.1 The parsing functions</a></li> 274 <li><a class="reference internal" href="#the-export-methods" id="id47">9.2 The export methods</a><ul class="auto-toc"> 275 <li><a class="reference internal" href="#method-export" id="id48">9.2.1 Method export</a></li> 276 <li><a class="reference internal" href="#method-exportliteral" id="id49">9.2.2 Method <tt class="docutils literal"><span class="pre">exportLiteral</span></tt></a><ul class="auto-toc"> 277 <li><a class="reference internal" href="#what-it-does" id="id50">9.2.2.1 What It Does</a></li> 278 <li><a class="reference internal" href="#why-you-might-care" id="id51">9.2.2.2 Why You Might Care</a></li> 279 <li><a class="reference internal" href="#how-to-use-it" id="id52">9.2.2.3 How to use it</a></li> 280 </ul> 281 </li> 282 </ul> 283 </li> 284 <li><a class="reference internal" href="#building-instances" id="id53">9.3 Building instances</a></li> 285 <li><a class="reference internal" href="#using-the-subclass-module" id="id54">9.4 Using the subclass module</a></li> 286 <li><a class="reference internal" href="#elements-with-attributes-but-no-nested-children" id="id55">9.5 Elements with attributes but no nested children</a></li> 287 <li><a class="reference internal" href="#id3" id="id56">9.6 Mixed content</a></li> 288 <li><a class="reference internal" href="#id5" id="id57">9.7 anyAttribute</a></li> 289 <li><a class="reference internal" href="#user-methods" id="id58">9.8 User Methods</a></li> 290 </ul> 291 </li> 292 <li><a class="reference internal" href="#how-to-modify-the-generated-code" id="id59">10 How-to Modify the Generated Code</a><ul class="auto-toc"> 293 <li><a class="reference internal" href="#adding-features-to-class-definitions" id="id60">10.1 Adding features to class definitions</a></li> 294 </ul> 295 </li> 296 <li><a class="reference internal" href="#examples-and-demonstrations" id="id61">11 Examples and Demonstrations</a></li> 297 <li><a class="reference internal" href="#sample-code-and-extensions" id="id62">12 Sample Code and Extensions</a><ul class="auto-toc"> 298 <li><a class="reference internal" href="#capturing-xs-date-elements-as-dates" id="id63">12.1 Capturing xs:date elements as dates</a></li> 299 </ul> 300 </li> 301 <li><a class="reference internal" href="#limitations-of-generateds" id="id64">13 Limitations of generateDS</a><ul class="auto-toc"> 302 <li><a class="reference internal" href="#xml-schema-limitations" id="id65">13.1 XML Schema limitations</a></li> 303 <li><a class="reference internal" href="#large-documents" id="id66">13.2 Large documents</a></li> 304 </ul> 305 </li> 306 <li><a class="reference internal" href="#includes-the-xml-schema-include-element" id="id67">14 Includes -- The XML Schema include element</a></li> 307 <li><a class="reference internal" href="#acknowledgment" id="id68">15 Acknowledgment</a></li> 308 <li><a class="reference internal" href="#see-also" id="id69">16 See Also</a></li> 304 309 </ul> 305 310 </div> … … 362 367 <h2><a class="toc-backref" href="#id8">2.1 Download</a></h2> 363 368 <p>You can find the distribution here: 364 <a class="reference external" href="http://www.rexx.com/~dkuhlman/generateDS-1.1 1a.tar.gz">http://www.rexx.com/~dkuhlman/generateDS-1.11a.tar.gz</a></p>369 <a class="reference external" href="http://www.rexx.com/~dkuhlman/generateDS-1.13a.tar.gz">http://www.rexx.com/~dkuhlman/generateDS-1.13a.tar.gz</a></p> 365 370 <p>It is also available at SourceForge: 366 371 <a class="reference external" href="http://sourceforge.net/projects/generateds/">http://sourceforge.net/projects/generateds/</a></p> … … 413 418 -s <subclassfilename> Output file name for subclasses 414 419 -p <prefix> Prefix string to be pre-pended to the class names 415 -n <mappingfilename> Transform names with table in mappingfilename.416 420 -f Force creation of output files. Do not ask. 417 421 -a <namespaceabbrev> Namespace abbreviation, e.g. "xsd:". … … 429 433 instead of get_var() and set_var(). 430 434 --user-methods= <module>, 431 -u <module Optional module containing user methods. See435 -u <module> Optional module containing user methods. See 432 436 section "User Methods" in the documentation. 437 --no-process-includes Do not process included XML Schema files. By 438 default, generateDS.py will insert content 439 from files referenced by <include ... /> 440 elements into the XML Schema to be processed. 433 441 </pre> 434 442 <p>The following command line flags are recognized by <tt class="docutils literal"><span class="pre">generateDS.py</span></tt>:</p> … … 524 532 classes as specified in the indicated module. For more 525 533 information, see section <a class="reference internal" href="#user-methods">User Methods</a>.</dd> 534 <dt>no-process-includes</dt> 535 <dd>Do not process included XML Schema files. By default, 536 generateDS.py will insert content from files referenced by 537 <tt class="docutils literal"><span class="pre"><include</span> <span class="pre">...</span> <span class="pre">/></span></tt> elements into the XML Schema to be processed. 538 See section <a class="reference internal" href="#include-file-processing">Include file processing</a>.</dd> 526 539 </dl> 527 540 </div> 528 <div class="section" id="name-conf icts">529 <h2><a class="toc-backref" href="#id13">4.2 Name conf icts</a></h2>541 <div class="section" id="name-conflicts"> 542 <h2><a class="toc-backref" href="#id13">4.2 Name conflicts</a></h2> 530 543 <div class="section" id="conflicts-with-python-keywords"> 531 544 <h3><a class="toc-backref" href="#id14">4.2.1 Conflicts with Python keywords</a></h3> … … 549 562 </div> 550 563 </div> 564 </div> 551 565 <div class="section" id="supported-features-of-xml-schema"> 552 <h 2><a class="toc-backref" href="#id16">4.3 Supported features of XML Schema</a></h2>566 <h1><a class="toc-backref" href="#id16">5 Supported features of XML Schema</a></h1> 553 567 <p>The following constructs in the XML Schema are supported:</p> 554 568 <ul class="simple"> … … 564 578 to generateDS</a>.</p> 565 579 <div class="section" id="attributes-no-nested-children"> 566 <h 3><a class="toc-backref" href="#id17">4.3.1 Attributes + no nested children</a></h3>580 <h2><a class="toc-backref" href="#id17">5.1 Attributes + no nested children</a></h2> 567 581 <p>Element definitions that contain attributes but <em>no</em> nested child 568 582 elements provide access to their data content through getter and … … 571 585 </div> 572 586 <div class="section" id="mixed-content"> 573 <h 3><a class="toc-backref" href="#id18">4.3.2 Mixed content</a></h3>587 <h2><a class="toc-backref" href="#id18">5.2 Mixed content</a></h2> 574 588 <p>Elements that are defined to contain both text and nested child 575 589 elements have "mixed content". <tt class="docutils literal"><span class="pre">generateDS.py</span></tt> provides access … … 584 598 </div> 585 599 <div class="section" id="anyattribute"> 586 <h 3><a class="toc-backref" href="#id19">4.3.3 anyAttribute</a></h3>600 <h2><a class="toc-backref" href="#id19">5.3 anyAttribute</a></h2> 587 601 <p><tt class="docutils literal"><span class="pre">generateDS.py</span></tt> supports <tt class="docutils literal"><span class="pre">anyAttribute</span></tt>. For example, if an 588 602 element is defined as follows:</p> … … 604 618 </div> 605 619 <div class="section" id="element-extensions"> 606 <h 3><a class="toc-backref" href="#id20">4.3.4 Element extensions</a></h3>620 <h2><a class="toc-backref" href="#id20">5.4 Element extensions</a></h2> 607 621 <p><tt class="docutils literal"><span class="pre">generateDS.py</span></tt> now generates subclasses for extensions, that is 608 622 when an element definition contains something like this:</p> … … 623 637 </div> 624 638 <div class="section" id="attribute-groups"> 625 <h 3><a class="toc-backref" href="#id21">4.3.5 Attribute groups</a></h3>639 <h2><a class="toc-backref" href="#id21">5.5 Attribute groups</a></h2> 626 640 <p><tt class="docutils literal"><span class="pre">generateDS.py</span></tt> now handles definition and use of attribute 627 641 groups. For example: the use of something like the following:</p> … … 645 659 </div> 646 660 <div class="section" id="substitution-groups"> 647 <h 3><a class="toc-backref" href="#id22">4.3.6 Substitution groups</a></h3>661 <h2><a class="toc-backref" href="#id22">5.6 Substitution groups</a></h2> 648 662 <p><tt class="docutils literal"><span class="pre">generateDS.py</span></tt> now handles a limited range of substitution 649 663 groups, but, there is an important <strong>limitation</strong>, in particular … … 656 670 </div> 657 671 <div class="section" id="primitive-types"> 658 <h 3><a class="toc-backref" href="#id23">4.3.7 Primitive types</a></h3>672 <h2><a class="toc-backref" href="#id23">5.7 Primitive types</a></h2> 659 673 <p><tt class="docutils literal"><span class="pre">generateDS.py</span></tt> supports some, but not all, simple types defined 660 674 in "XML Schema Part 0: Primer Second Edition" ( … … 683 697 </div> 684 698 <div class="section" id="simpletype"> 685 <h 3><a class="toc-backref" href="#id24">4.3.8 simpleType</a></h3>699 <h2><a class="toc-backref" href="#id24">5.8 simpleType</a></h2> 686 700 <p><tt class="docutils literal"><span class="pre">generateDS.py</span></tt> generates minimal support for members defined as 687 701 <tt class="docutils literal"><span class="pre">simpleType</span></tt>. However, the code generated by <tt class="docutils literal"><span class="pre">generateDS.py</span></tt> 688 does <strong>not</strong> enforce res criptions. For notes on how to enforce702 does <strong>not</strong> enforce restrictions. For notes on how to enforce 689 703 restrictions, see section <a class="reference internal" href="#simpletype-and-validators">simpleType and validators</a>.</p> 690 704 <p>A <tt class="docutils literal"><span class="pre">simpleType</span></tt> can be a restriction on a primitive type or on a … … 722 736 </div> 723 737 <div class="section" id="list-values-optional-values-maxoccurs-etc"> 724 <h 3><a class="toc-backref" href="#id25">4.3.9 List values, optional values, maxOccurs, etc.</a></h3>738 <h2><a class="toc-backref" href="#id25">5.9 List values, optional values, maxOccurs, etc.</a></h2> 725 739 <p>For elements defined with <tt class="docutils literal"><span class="pre">maxOccurs="unbounded"</span></tt>, 726 740 <tt class="docutils literal"><span class="pre">generateDS.py</span></tt> generates code that processes a list of elements.</p> … … 730 744 </div> 731 745 <div class="section" id="simpletype-and-validators"> 732 <h 3><a class="toc-backref" href="#id26">4.3.10 simpleType and validators</a></h3>746 <h2><a class="toc-backref" href="#id26">5.10 simpleType and validators</a></h2> 733 747 <p>Here are a few notes that should help you use validator methods to 734 748 enforce restrictions.</p> … … 843 857 </ul> 844 858 </div> 859 <div class="section" id="include-file-processing"> 860 <h2><a class="toc-backref" href="#id27">5.11 Include file processing</a></h2> 861 <p>By default, generateDS.py will insert content from files referenced by 862 <tt class="docutils literal"><span class="pre">include</span></tt> elements into the XML Schema to be processed. This 863 behavior can be turned off by using the <tt class="docutils literal"><span class="pre">--no-process-includes</span></tt> 864 command line flag.</p> 865 <p><tt class="docutils literal"><span class="pre">include</span></tt> elements are processed and the referenced content is 866 inserted in the XML Schema by importing and using 867 <tt class="docutils literal"><span class="pre">process_includes.py</span></tt>, which is included in the <tt class="docutils literal"><span class="pre">generateDS.py</span></tt> 868 distribution.</p> 869 <p><tt class="docutils literal"><span class="pre">process_includes.py</span></tt> will use either <tt class="docutils literal"><span class="pre">lxml</span></tt> or <tt class="docutils literal"><span class="pre">ElementTree</span></tt>, 870 but its preference is <tt class="docutils literal"><span class="pre">lxml</span></tt> because <tt class="docutils literal"><span class="pre">lxml</span></tt> attempts to preserve 871 namespace prefixes. So if your XML Schemas have <tt class="docutils literal"><span class="pre"><include</span> <span class="pre">...</span> <span class="pre">/></span></tt> 872 elements in them, you might want to consider installing <tt class="docutils literal"><span class="pre">lxml</span></tt>, even 873 though <tt class="docutils literal"><span class="pre">ElementTree</span></tt> is in the Python standard library for Python 874 versions >= 2.5.</p> 845 875 </div> 846 876 </div> 847 877 <div class="section" id="the-xml-schema-input-to-generateds"> 848 <h1><a class="toc-backref" href="#id2 7">5 The XML Schema Input to generateDS</a></h1>878 <h1><a class="toc-backref" href="#id28">6 The XML Schema Input to generateDS</a></h1> 849 879 <p><tt class="docutils literal"><span class="pre">generateDS.py</span></tt> actually accepts a subset of XML Schema. 850 880 The sample XML Schema file should give you a picture of how to … … 959 989 </ul> 960 990 <div class="section" id="additional-constructions"> 961 <h2><a class="toc-backref" href="#id2 8">5.1 Additional constructions</a></h2>991 <h2><a class="toc-backref" href="#id29">6.1 Additional constructions</a></h2> 962 992 <p>Here are a few additional constructions that <tt class="docutils literal"><span class="pre">generateDS.py</span></tt> 963 993 understands.</p> 964 994 <div class="section" id="complextype-at-top-level"> 965 <h3><a class="toc-backref" href="#id 29">5.1.1 <complexType> at top-level</a></h3>995 <h3><a class="toc-backref" href="#id30">6.1.1 <complexType> at top-level</a></h3> 966 996 <p>You can use the <complexType> element at top level (instead of 967 997 <element>) to define an element. So, for example, instead of:</p> … … 987 1017 </div> 988 1018 <div class="section" id="use-of-ref-instead-of-name-and-type-attributes"> 989 <h3><a class="toc-backref" href="#id3 0">5.1.2 Use of "ref" instead of "name" and "type" attributes</a></h3>1019 <h3><a class="toc-backref" href="#id31">6.1.2 Use of "ref" instead of "name" and "type" attributes</a></h3> 990 1020 <p>You can use the "ref" attribute to refer to another element 991 1021 definition, instead of using the "name" and "type" attributes. So, … … 1012 1042 </div> 1013 1043 <div class="section" id="extension-types"> 1014 <h3><a class="toc-backref" href="#id3 1">5.1.3 Extension types</a></h3>1044 <h3><a class="toc-backref" href="#id32">6.1.3 Extension types</a></h3> 1015 1045 <p><tt class="docutils literal"><span class="pre">generateDS.py</span></tt> generates a subclass for each element that that 1016 1046 is defined as the extension of a base element. So, for the … … 1034 1064 </div> 1035 1065 <div class="section" id="elements-containing-mixed-content"> 1036 <h3><a class="toc-backref" href="#id3 2">5.1.4 Elements containing mixed content</a></h3>1066 <h3><a class="toc-backref" href="#id33">6.1.4 Elements containing mixed content</a></h3> 1037 1067 <p><tt class="docutils literal"><span class="pre">generateDS.py</span></tt> generates special code to handle elements 1038 1068 defined as containing mixed content, that is elements defined with … … 1043 1073 </div> 1044 1074 <div class="section" id="id1"> 1045 <span id="xmlbehaviors"></span><h1><a class="toc-backref" href="#id3 3">6 XMLBehaviors</a></h1>1075 <span id="xmlbehaviors"></span><h1><a class="toc-backref" href="#id34">7 XMLBehaviors</a></h1> 1046 1076 <p>With the use of the "-b" command line flag, <tt class="docutils literal"><span class="pre">generateDS.py</span></tt> will 1047 1077 also accept as input an XML document instance that describes … … 1055 1085 our application development project for Quixote.</p> 1056 1086 <div class="section" id="the-xmlbehaviors-input-file"> 1057 <h2><a class="toc-backref" href="#id3 4">6.1 The XMLBehaviors input file</a></h2>1087 <h2><a class="toc-backref" href="#id35">7.1 The XMLBehaviors input file</a></h2> 1058 1088 <p>This section describes the XMLBehavior XML document that is used 1059 1089 as input to <tt class="docutils literal"><span class="pre">generateDS.py</span></tt>. The XMLBehavior XML document is an … … 1128 1158 </div> 1129 1159 <div class="section" id="implementing-other-sources-for-implementation-bodies"> 1130 <h2><a class="toc-backref" href="#id3 5">6.2 Implementing other sources for implementation bodies</a></h2>1160 <h2><a class="toc-backref" href="#id36">7.2 &
