diff --git a/README b/README index e70ab60ac94ce2ae8785817f66d5a34b3a1d72ec..67cd5dbe0d274e84467e17a1ddfe73f8017b55c8 100644 --- a/README +++ b/README @@ -141,6 +141,17 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Change history -------------- +Version 2.26a (05/01/2017) + +- Added command line options --no-collect-includes and + --no-redefine-groups. These options selectively turn off tasks + performed in process_includes.py. These options were added + because the use of --no-process-includes (which omits all + processing done in process_includes.py) was reported to cause + errors. See the documentation and the usage message (run + `generateDS.py --help`) for more information. Thanks to + Florian Wilmshoever for reporting and working with me on this. + Version 2.25a (03/21/2017) - Fixes to the Django support for Python 3. Thanks to Shane Rigby diff --git a/generateDS.html b/generateDS.html index 360507346e871af15fbba0cff8a9fe9ba6d3172e..2c820420c792cc36af317f784612f7b4bf50434f 100644 --- a/generateDS.html +++ b/generateDS.html @@ -220,7 +220,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.25a</td> +<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.26a</td> </tr> </tbody> </table> @@ -229,7 +229,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">date:</th><td class="field-body">March 21, 2017</td> +<tr class="field"><th class="field-name">date:</th><td class="field-body">April 28, 2017</td> </tr> </tbody> </table> @@ -380,12 +380,12 @@ to process the contents of an XML document.</td> </li> <li><a class="reference internal" href="#limitations-of-generateds" id="id92">17 Limitations of generateDS</a><ul class="auto-toc"> <li><a class="reference internal" href="#xml-schema-limitations" id="id93">17.1 XML Schema limitations</a></li> -<li><a class="reference internal" href="#large-documents" id="id94">17.2 Large documents</a></li> </ul> </li> -<li><a class="reference internal" href="#includes-the-xml-schema-include-element" id="id95">18 Includes -- The XML schema include element</a></li> -<li><a class="reference internal" href="#acknowledgments" id="id96">19 Acknowledgments</a></li> -<li><a class="reference internal" href="#see-also" id="id97">20 See also</a></li> +<li><a class="reference internal" href="#includes-the-xml-schema-xs-include-and-xs-import-elements" id="id94">18 Includes -- The XML schema xs:include and xs:import elements</a></li> +<li><a class="reference internal" href="#processing-relaxng-schemas" id="id95">19 Processing RelaxNG schemas</a></li> +<li><a class="reference internal" href="#acknowledgments" id="id96">20 Acknowledgments</a></li> +<li><a class="reference internal" href="#see-also" id="id97">21 See also</a></li> </ul> </div> <div class="section" id="introduction"> @@ -586,10 +586,19 @@ Options: generated files. This is useful if you want to minimize the amount of (no-operation) changes to the generated python code. - --no-process-includes Do not process included XML schema files. By - default, generateDS.py will insert content - from files referenced by <include ... /> - elements into the XML schema to be processed. + --no-process-includes Do not use process_includes.py to pre-process + included XML schema files. By default, + generateDS.py will insert content from files + referenced by xs:include and xs:import elements + into the XML schema to be processed and perform + several other pre-procesing tasks. You likely do + not want to use this option; its use has been + reported to result in errors in generated modules. + Consider using --no-collect-includes and/or + --no-redefine-groups instead. + --no-collect-includes Do not (recursively) collect and insert schemas + referenced by xs:include and xs:import elements. + --no-redefine-groups Do not pre-process and redefine group definitions. --silence Normally, the code generated with generateDS echoes the information being parsed. To prevent the echo from occurring, use the --silence switch. @@ -802,15 +811,30 @@ changes to the generated python code.</dd> useful if you want to minimize the amount of (no-operation) changes to the generated python code.</dd> <dt>no-process-includes</dt> -<dd>Do not process included XML Schema files. By default, -generateDS.py will insert content from files referenced by -<tt class="docutils literal"><include ... /></tt> elements into the XML Schema to be processed. -See section <a class="reference internal" href="#include-file-processing">Include file processing</a>. Note that include -processing, which is performed in <tt class="docutils literal">process_includes.py</tt> is -required for generating validator bodies from the XML schema, -because the Lxml ElementTree produced in <tt class="docutils literal">process_includes.py</tt> -is needed to generate the validator code. So, using this option -also turns off automatic generation of validator code.</dd> +<dd>Do not use <tt class="docutils literal">process_includes.py</tt> to pre-process included XML +Schema files. By default, generateDS.py will insert content +from files referenced by <tt class="docutils literal">xs:include</tt> and <tt class="docutils literal">xs:import</tt> +elements into the XML Schema to be processed. See section +<a class="reference internal" href="#include-file-processing">Include file processing</a>. Note that include processing, which +is performed in <tt class="docutils literal">process_includes.py</tt> is required for +generating validator bodies from the XML schema, because the +Lxml ElementTree produced in <tt class="docutils literal">process_includes.py</tt> is needed +to generate the validator code. So, using this option also +turns off automatic generation of validator code. Also note +that process_includes(.py) performs additional tasks; it also +(1) assigns names to each anonymous complexType, (2) processes +(replaces) group definitions, and (3) possibly fixes complexType +names (see command line option --fix-type-names). You likely do +not want to use this option; its use has been reported to result +in errors in generated modules. Consider using +--no-collect-includes and/or --no-redefine-groups instead.</dd> +<dt>no-collect-includes</dt> +<dd>Do not (recursively) collect and insert schemas referenced by +<tt class="docutils literal">xs:include</tt> and <tt class="docutils literal">xs:import</tt> elements. This task is +performed in <tt class="docutils literal">process_includes.py</tt>.</dd> +<dt>no-redefine-groups</dt> +<dd>Do not pre-process and redefine group definitions. This task is +performed in <tt class="docutils literal">process_includes.py</tt>.</dd> <dt>silence</dt> <dd>Normally, the code generated with generateDS echoes the information being parsed. To prevent the echo from occurring, @@ -3111,41 +3135,24 @@ people.xml for examples.</p> <p>And, then, try it on your XML Schema, and let me know about what does not work.</p> </div> -<div class="section" id="large-documents"> -<h2><a class="toc-backref" href="#id94">17.2 Large documents</a></h2> -<p><strong>Warning</strong> -- This section describes an optional generated SAX -parser which, I believe, is currently broken for all but the -simplest schemas. Generation of a SAX parser has not been updated -for the latest changes to <tt class="docutils literal">generateDS.py</tt>. In particular, when -names of elements are reused (in different parent elements), the -SAX parser becomes confused. Until I've been able to figure out -how to fix this, you are advised not to use the SAX parser.</p> -<p><tt class="docutils literal">generateDS.py</tt> generates two kinds of parsers: one kind is -based on SAX and the other is build on minidom. See the generated -functions saxParse, parse(), and parseString(). Using the SAX -parser instead of the minidom parser should reduce memory -requirements for large documents, since the minidom parser, but -not the SAX parser, constructs a DOM tree for the entire document -in memory.</p> -<p>However, both styles of parsers construct instances of the data -structures generated by <tt class="docutils literal">generateDS.py</tt>. This means that, even -when the SAX parser is used, <tt class="docutils literal">generateDS.py</tt> may not be -well-suited for applications that read large XML documents, -although what "large" means depends on your hardware. Notice that -the minidom parsing functions (parse() and parseString()) -over-write the variable doc so as to enable Python to reclaim the -space occupied by the DOM tree, which may help alleviate the -memory problem to some extent when the minidom parser is used.</p> -</div> -</div> -<div class="section" id="includes-the-xml-schema-include-element"> -<h1><a class="toc-backref" href="#id95">18 Includes -- The XML schema include element</a></h1> +</div> +<div class="section" id="includes-the-xml-schema-xs-include-and-xs-import-elements"> +<h1><a class="toc-backref" href="#id94">18 Includes -- The XML schema xs:include and xs:import elements</a></h1> <p>While <tt class="docutils literal">generateDS.py</tt> itself does not process XML Schema <tt class="docutils literal">include</tt> elements, the distribution provides a script -<tt class="docutils literal">process_includes.py</tt> that can be used as a preprocessor. This -script scans your XML Schema document and, recursively, documents -that are included looking for <tt class="docutils literal">include</tt> elements; it inserts all -content into a single document, which it writes out.</p> +<tt class="docutils literal">process_includes.py</tt> that can be used as a preprocessor. +<tt class="docutils literal">process_includes.py</tt> is called automatically and by default by +<tt class="docutils literal">generateDS.py</tt>. This behavior can be turned off with the +<tt class="docutils literal"><span class="pre">--no-process-includes</span></tt> command line option. <strong>However</strong>, doing +so is not advised, because unexpected and undesirable behavior has +been detected this is done. Instead consider using the +<tt class="docutils literal"><span class="pre">--no-collect-includes</span></tt> and <tt class="docutils literal"><span class="pre">--no-redefine-groups</span></tt> command line +options to selectively turn of specific processing done in +<tt class="docutils literal">process_includes.py</tt>.</p> +<p>The <tt class="docutils literal">process_includes.py</tt> script scans your XML Schema document +and, recursively, documents that are included looking for +<tt class="docutils literal">include</tt> elements; it inserts all content into a single document, +which it writes out.</p> <p>Here are samples of how you might use <tt class="docutils literal">process_includes.py</tt>, if your schema contains <tt class="docutils literal">include</tt> elements.</p> <p>Example 1:</p> @@ -3163,8 +3170,49 @@ $ python generateDS.py -f --super=task1sup -o task1sup.py -s task1sub.py tmp.xsd $ python process_includes.py --help </pre> </div> +<div class="section" id="processing-relaxng-schemas"> +<h1><a class="toc-backref" href="#id95">19 Processing RelaxNG schemas</a></h1> +<p>RelaxNG is a schema definition language and is an alternative to XML +Schema. For more information on RelaxNG, see: <a class="reference external" href="http://relaxng.org/">http://relaxng.org/</a>.</p> +<p><tt class="docutils literal">generateDS.py</tt> does not understand or process RelaxNG schemas. +However, the <tt class="docutils literal">trang</tt> application is able to convert RelaxNG into +XML Schemas. I've tried it, and was able to convert a relatively +small RelaxNG schema into an XML Schema, and then use +<tt class="docutils literal">generateDS.py</tt> to generate a bindings module from that. I have +not done any serious testing to determine how complete or accurate +this conversion is. <tt class="docutils literal">trang</tt> is written in Java, so you will need +Java and the JDK installed in order to compile and use it. For what +it's worth, here are the steps I followed in order to use <tt class="docutils literal">trang</tt>:</p> +<ol class="arabic"> +<li><p class="first">Clone trang from <a class="reference external" href="https://github.com/relaxng/jing-trang.git">https://github.com/relaxng/jing-trang.git</a>, +and, then built it with:</p> +<pre class="literal-block"> +$ git clone https://github.com/relaxng/jing-trang.git +$ cd jing-trang +# set JAVA_HOME to location of JDK +$ export JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt +$ ./ant +</pre> +</li> +<li><p class="first">Run <tt class="docutils literal">trang</tt> with the following:</p> +<pre class="literal-block"> +$ cd jing-trang/build +$ java -jar trang.jar -I rng -O xsd test01.rng test01.xsd +</pre> +<p>The above command produced test01.xsd.</p> +</li> +<li><p class="first">Run the resulting XML Schema (<tt class="docutils literal">test01.xsd</tt>, in the above case) +through <tt class="docutils literal">generateDS.py</tt>:</p> +<blockquote> +<p>$ generateDS.py -o test01sup.py -s test01sub.py test01.xsd</p> +</blockquote> +</li> +</ol> +<p>You can learn more about <tt class="docutils literal">trang</tt> at the RelaxNG web site and here: +<a class="reference external" href="https://github.com/relaxng/jing-trang">https://github.com/relaxng/jing-trang</a></p> +</div> <div class="section" id="acknowledgments"> -<h1><a class="toc-backref" href="#id96">19 Acknowledgments</a></h1> +<h1><a class="toc-backref" href="#id96">20 Acknowledgments</a></h1> <p>Many thanks to those who have used <tt class="docutils literal">generateDS.py</tt> and have contributed their comments and suggestions. These comments have been valuable both in teaching me about things I needed to know in @@ -3178,7 +3226,7 @@ following among others:</p> </ul> </div> <div class="section" id="see-also"> -<h1><a class="toc-backref" href="#id97">20 See also</a></h1> +<h1><a class="toc-backref" href="#id97">21 See also</a></h1> <p><a class="reference external" href="http://www.python.org">Python</a>: The Python home page.</p> <p><a class="reference external" href="http://www.davekuhlman.org">Dave's Page</a>: My home page, which contains more Python stuff.</p> <!-- vim:ft=rst: --> @@ -3187,7 +3235,7 @@ following among others:</p> <div class="footer"> <hr class="footer" /> <a class="reference external" href="generateDS.txt">View document source</a>. -Generated on: 2017-03-21 19:50 UTC. +Generated on: 2017-04-28 21:54 UTC. Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. </div> diff --git a/generateDS.py b/generateDS.py index c26a2713b93e7a90139dc2f0031a1edb1dfe1f0e..693cef95242fa646ea4a5c0eb8dd383c763efa0d 100755 --- a/generateDS.py +++ b/generateDS.py @@ -56,10 +56,19 @@ Options: generated files. This is useful if you want to minimize the amount of (no-operation) changes to the generated python code. - --no-process-includes Do not process included XML schema files. By - default, generateDS.py will insert content - from files referenced by <include ... /> - elements into the XML schema to be processed. + --no-process-includes Do not use process_includes.py to pre-process + included XML schema files. By default, + generateDS.py will insert content from files + referenced by xs:include and xs:import elements + into the XML schema to be processed and perform + several other pre-procesing tasks. You likely do + not want to use this option; its use has been + reported to result in errors in generated modules. + Consider using --no-collect-includes and/or + --no-redefine-groups instead. + --no-collect-includes Do not (recursively) collect and insert schemas + referenced by xs:include and xs:import elements. + --no-redefine-groups Do not pre-process and redefine group definitions. --silence Normally, the code generated with generateDS echoes the information being parsed. To prevent the echo from occurring, use the --silence switch. @@ -204,7 +213,7 @@ logging.disable(logging.INFO) # Do not modify the following VERSION comments. # Used by updateversion.py. ##VERSION## -VERSION = '2.25a' +VERSION = '2.26a' ##VERSION## if sys.version_info.major == 2: @@ -508,6 +517,7 @@ def set_type_constants(nameSpace): # For debugging. # + # Print only if DEBUG is true. DEBUG = 0 @@ -6681,9 +6691,18 @@ def is_builtin_simple_type(type_val): def parseAndGenerate( - outfileName, subclassFilename, prefix, - xschemaFileName, behaviorFilename, catalogFilename, - processIncludes, options, args, superModule='???'): + outfileName, + subclassFilename, + prefix, + xschemaFileName, + behaviorFilename, + catalogFilename, + processIncludes, + options, + noCollectIncludes, + noRedefineGroups, + args, + superModule='???'): global DelayedElements, DelayedElements_subclass, \ AlreadyGenerated, SaxDelayedElements, \ AlreadyGenerated_subclass, UserMethodsPath, UserMethodsModule, \ @@ -6718,7 +6737,10 @@ def parseAndGenerate( infile, outfile, inpath=xschemaFileName, catalogpath=catalogFilename, - fixtypenames=FixTypeNames) + fixtypenames=FixTypeNames, + no_collect_includes=noCollectIncludes, + no_redefine_groups=noRedefineGroups, + ) outfile.seek(0) infile = outfile SchemaLxmlTree = doc.getroot() @@ -6963,6 +6985,7 @@ def main(): 'module-suffix=', 'use-old-simpletype-validators', 'preserve-cdata-tags', 'cleanup-name-list=', 'no-warnings', + 'no-collect-includes', 'no-redefine-groups', ]) except getopt.GetoptError: usage() @@ -6981,6 +7004,8 @@ def main(): showVersion = False xschemaFileName = None catalogFilename = None + noCollectIncludes = False + noRedefineGroups = False for option in options: if option[0] == '--session': sessionFilename = option[1] @@ -7149,6 +7174,10 @@ def main(): CleanupNameList = capture_cleanup_name_list(option[1]) elif option[0] == '--no-warnings': NoWarnings = True + elif option[0] == '--no-collect-includes': + noCollectIncludes = True + elif option[0] == '--no-redefine-groups': + noRedefineGroups = True if showVersion: print('generateDS.py version %s' % VERSION) sys.exit(0) @@ -7169,9 +7198,18 @@ def main(): TEMPLATE_SUBCLASS_FOOTER = fixSilence(TEMPLATE_SUBCLASS_FOOTER, silent) load_config() parseAndGenerate( - outFilename, subclassFilename, prefix, - xschemaFileName, behaviorFilename, catalogFilename, - processIncludes, options, args, superModule=superModule) + outFilename, + subclassFilename, + prefix, + xschemaFileName, + behaviorFilename, + catalogFilename, + processIncludes, + options, + noCollectIncludes, + noRedefineGroups, + args, + superModule=superModule) if __name__ == '__main__': diff --git a/generateDS.txt b/generateDS.txt index f07e88dc665d369f7028aac154e752ac169363b6..bd38a49824e5b092a860add65743a443749530e0 100644 --- a/generateDS.txt +++ b/generateDS.txt @@ -12,7 +12,7 @@ generateDS -- Generate Data Structures from XML Schema .. version -:revision: 2.25a +:revision: 2.26a .. version @@ -278,10 +278,19 @@ Here is the usage message displayed by ``generateDS.py``:: generated files. This is useful if you want to minimize the amount of (no-operation) changes to the generated python code. - --no-process-includes Do not process included XML schema files. By - default, generateDS.py will insert content - from files referenced by <include ... /> - elements into the XML schema to be processed. + --no-process-includes Do not use process_includes.py to pre-process + included XML schema files. By default, + generateDS.py will insert content from files + referenced by xs:include and xs:import elements + into the XML schema to be processed and perform + several other pre-procesing tasks. You likely do + not want to use this option; its use has been + reported to result in errors in generated modules. + Consider using --no-collect-includes and/or + --no-redefine-groups instead. + --no-collect-includes Do not (recursively) collect and insert schemas + referenced by xs:include and xs:import elements. + --no-redefine-groups Do not pre-process and redefine group definitions. --silence Normally, the code generated with generateDS echoes the information being parsed. To prevent the echo from occurring, use the --silence switch. @@ -511,15 +520,32 @@ no-versions changes to the generated python code. no-process-includes - Do not process included XML Schema files. By default, - generateDS.py will insert content from files referenced by - ``<include ... />`` elements into the XML Schema to be processed. - See section `Include file processing`_. Note that include - processing, which is performed in ``process_includes.py`` is - required for generating validator bodies from the XML schema, - because the Lxml ElementTree produced in ``process_includes.py`` - is needed to generate the validator code. So, using this option - also turns off automatic generation of validator code. + Do not use ``process_includes.py`` to pre-process included XML + Schema files. By default, generateDS.py will insert content + from files referenced by ``xs:include`` and ``xs:import`` + elements into the XML Schema to be processed. See section + `Include file processing`_. Note that include processing, which + is performed in ``process_includes.py`` is required for + generating validator bodies from the XML schema, because the + Lxml ElementTree produced in ``process_includes.py`` is needed + to generate the validator code. So, using this option also + turns off automatic generation of validator code. Also note + that process_includes(.py) performs additional tasks; it also + (1) assigns names to each anonymous complexType, (2) processes + (replaces) group definitions, and (3) possibly fixes complexType + names (see command line option --fix-type-names). You likely do + not want to use this option; its use has been reported to result + in errors in generated modules. Consider using + --no-collect-includes and/or --no-redefine-groups instead. + +no-collect-includes + Do not (recursively) collect and insert schemas referenced by + ``xs:include`` and ``xs:import`` elements. This task is + performed in ``process_includes.py``. + +no-redefine-groups + Do not pre-process and redefine group definitions. This task is + performed in ``process_includes.py``. silence Normally, the code generated with generateDS echoes the @@ -3057,45 +3083,25 @@ And, then, try it on your XML Schema, and let me know about what does not work. -Large documents ---------------- - -**Warning** -- This section describes an optional generated SAX -parser which, I believe, is currently broken for all but the -simplest schemas. Generation of a SAX parser has not been updated -for the latest changes to ``generateDS.py``. In particular, when -names of elements are reused (in different parent elements), the -SAX parser becomes confused. Until I've been able to figure out -how to fix this, you are advised not to use the SAX parser. - -``generateDS.py`` generates two kinds of parsers: one kind is -based on SAX and the other is build on minidom. See the generated -functions saxParse, parse(), and parseString(). Using the SAX -parser instead of the minidom parser should reduce memory -requirements for large documents, since the minidom parser, but -not the SAX parser, constructs a DOM tree for the entire document -in memory. - -However, both styles of parsers construct instances of the data -structures generated by ``generateDS.py``. This means that, even -when the SAX parser is used, ``generateDS.py`` may not be -well-suited for applications that read large XML documents, -although what "large" means depends on your hardware. Notice that -the minidom parsing functions (parse() and parseString()) -over-write the variable doc so as to enable Python to reclaim the -space occupied by the DOM tree, which may help alleviate the -memory problem to some extent when the minidom parser is used. - - -Includes -- The XML schema include element -========================================== +Includes -- The XML schema xs:include and xs:import elements +============================================================== While ``generateDS.py`` itself does not process XML Schema ``include`` elements, the distribution provides a script -``process_includes.py`` that can be used as a preprocessor. This -script scans your XML Schema document and, recursively, documents -that are included looking for ``include`` elements; it inserts all -content into a single document, which it writes out. +``process_includes.py`` that can be used as a preprocessor. +``process_includes.py`` is called automatically and by default by +``generateDS.py``. This behavior can be turned off with the +``--no-process-includes`` command line option. **However**, doing +so is not advised, because unexpected and undesirable behavior has +been detected this is done. Instead consider using the +``--no-collect-includes`` and ``--no-redefine-groups`` command line +options to selectively turn of specific processing done in +``process_includes.py``. + +The ``process_includes.py`` script scans your XML Schema document +and, recursively, documents that are included looking for +``include`` elements; it inserts all content into a single document, +which it writes out. Here are samples of how you might use ``process_includes.py``, if your schema contains ``include`` elements. @@ -3115,6 +3121,47 @@ For help and usage information, run the following:: $ python process_includes.py --help +Processing RelaxNG schemas +============================ + +RelaxNG is a schema definition language and is an alternative to XML +Schema. For more information on RelaxNG, see: http://relaxng.org/. + +``generateDS.py`` does not understand or process RelaxNG schemas. +However, the ``trang`` application is able to convert RelaxNG into +XML Schemas. I've tried it, and was able to convert a relatively +small RelaxNG schema into an XML Schema, and then use +``generateDS.py`` to generate a bindings module from that. I have +not done any serious testing to determine how complete or accurate +this conversion is. ``trang`` is written in Java, so you will need +Java and the JDK installed in order to compile and use it. For what +it's worth, here are the steps I followed in order to use ``trang``: + +1. Clone trang from https://github.com/relaxng/jing-trang.git, + and, then built it with:: + + $ git clone https://github.com/relaxng/jing-trang.git + $ cd jing-trang + # set JAVA_HOME to location of JDK + $ export JAVA_HOME=/usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt + $ ./ant + +2. Run ``trang`` with the following:: + + $ cd jing-trang/build + $ java -jar trang.jar -I rng -O xsd test01.rng test01.xsd + + The above command produced test01.xsd. + +3. Run the resulting XML Schema (``test01.xsd``, in the above case) + through ``generateDS.py``: + + $ generateDS.py -o test01sup.py -s test01sub.py test01.xsd + +You can learn more about ``trang`` at the RelaxNG web site and here: +https://github.com/relaxng/jing-trang + + Acknowledgments ================= diff --git a/generateds_gui_notes.html b/generateds_gui_notes.html index fd42cbb3287d28c6bc0ad35bfec1c09dbe967f6a..58e6b4e20855bf8cfd05969f8cf5911bc6202883 100644 --- a/generateds_gui_notes.html +++ b/generateds_gui_notes.html @@ -220,7 +220,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.25a</td> +<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.26a</td> </tr> </tbody> </table> @@ -229,7 +229,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">date:</th><td class="field-body">March 21, 2017</td> +<tr class="field"><th class="field-name">date:</th><td class="field-body">April 28, 2017</td> </tr> </tbody> </table> @@ -401,7 +401,7 @@ $ mv generateds_gui.mo locale/ru/LC_MESSAGES/ <div class="footer"> <hr class="footer" /> <a class="reference external" href="generateds_gui_notes.txt">View document source</a>. -Generated on: 2017-03-21 19:50 UTC. +Generated on: 2017-04-28 21:54 UTC. Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. </div> diff --git a/generateds_gui_notes.txt b/generateds_gui_notes.txt index ca2d1d2be71a91e64d0af2af45a29c21539df79d..49d17c20439a2530d774cea7b0ce3158dbe62b10 100644 --- a/generateds_gui_notes.txt +++ b/generateds_gui_notes.txt @@ -12,7 +12,7 @@ GenerateDS GUI Notes .. version -:revision: 2.25a +:revision: 2.26a .. version diff --git a/gui/generateds_gui.py b/gui/generateds_gui.py index d5cf4cdabcc493446f0e69bae3dada591dfbc337..5a7e6a4e1700fb4daa417713294c23e47a4fe102 100755 --- a/gui/generateds_gui.py +++ b/gui/generateds_gui.py @@ -41,7 +41,7 @@ from libgenerateDS.gui import generateds_gui_session # Do not modify the following VERSION comments. # Used by updateversion.py. ##VERSION## -VERSION = '2.25a' +VERSION = '2.26a' ##VERSION## diff --git a/librarytemplate_howto.html b/librarytemplate_howto.html index 1790efe5a88b98c6dd7264cdf2c27b38c695d3e7..b5fa21220f076c9398bdb783924c8bd6a05f0618 100644 --- a/librarytemplate_howto.html +++ b/librarytemplate_howto.html @@ -217,7 +217,7 @@ dkuhlman (at) davekuhlman (dot) org <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.25a</td> +<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.26a</td> </tr> </tbody> </table> @@ -226,7 +226,7 @@ dkuhlman (at) davekuhlman (dot) org <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">date:</th><td class="field-body">March 21, 2017</td> +<tr class="field"><th class="field-name">date:</th><td class="field-body">April 28, 2017</td> </tr> </tbody> </table> @@ -380,7 +380,7 @@ this command for your needs. For example, you may need to use <div class="footer"> <hr class="footer" /> <a class="reference external" href="librarytemplate_howto.txt">View document source</a>. -Generated on: 2017-03-21 19:50 UTC. +Generated on: 2017-04-28 21:54 UTC. Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. </div> diff --git a/librarytemplate_howto.txt b/librarytemplate_howto.txt index a2a52cb06c982435ee0e2bf4099f2c6cb8e508e8..28383c0bc796994115503f2453c90c1ea77f135f 100644 --- a/librarytemplate_howto.txt +++ b/librarytemplate_howto.txt @@ -8,7 +8,7 @@ How to package a generateDS.py generated library .. version -:revision: 2.25a +:revision: 2.26a .. version diff --git a/process_includes.py b/process_includes.py index bbdc026ab857ebcc4ea09d331d3c50b2c78b764e..17539a0abc2c4f21b9cc6ed877281d1bad9f945e 100755 --- a/process_includes.py +++ b/process_includes.py @@ -40,7 +40,7 @@ except ImportError: # Do not modify the following VERSION comments. # Used by updateversion.py. ##VERSION## -VERSION = '2.25a' +VERSION = '2.26a' ##VERSION## CatalogDict = {} @@ -73,12 +73,17 @@ def load_catalog(catalogpath): def process_include_files( - infile, outfile, inpath='', catalogpath=None, - fixtypenames=None): + infile, outfile, inpath='', + catalogpath=None, + fixtypenames=None, + no_collect_includes=False, + no_redefine_groups=False): load_catalog(catalogpath) options = Values({ 'force': False, 'fixtypenames': fixtypenames, + 'no_collect_includes': no_collect_includes, + 'no_redefine_groups': no_redefine_groups, }) doc = prep_schema_doc(infile, outfile, inpath, options) return doc @@ -301,12 +306,16 @@ def prep_schema_doc(infile, outfile, inpath, options): params.parent_url = infile params.base_url = os.path.split(inpath)[0] inserts = [] - collect_inserts(root1, params, inserts, options) - root2 = copy.copy(root1) - clear_includes_and_imports(root2) - for insert_node in inserts: - root2.append(insert_node) - process_groups(root2) + if not options.no_collect_includes: + collect_inserts(root1, params, inserts, options) + root2 = copy.copy(root1) + clear_includes_and_imports(root2) + for insert_node in inserts: + root2.append(insert_node) + else: + root2 = root1 + if not options.no_redefine_groups: + process_groups(root2) raise_anon_complextypes(root2) fix_type_names(root2, options) doc2 = etree.ElementTree(root2) @@ -600,6 +609,15 @@ def main(): "--fix-type-names", action="store", dest="fixtypenames", default=None, help="Fix up (replace) complex type names.") + parser.add_option( + "--no-collect-includes", action="store_true", + dest="no_collect_includes", default=False, + help="do not process and insert schemas referenced by " + "xs:include and xs:import elements") + parser.add_option( + "--no-redefine-groups", action="store_true", + dest="no_redefine_groups", default=False, + help="do not pre-process and redefine xs:group elements") (options, args) = parser.parse_args() if len(args) == 2: inpath = args[0] diff --git a/setup.py b/setup.py index adfdbd1259b077d2021d38313768c058a609c19d..6be7d960dd747df93de078f71bfad8a6d2141a94 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup(name="generateDS", # Do not modify the following VERSION comments. # Used by updateversion.py. ##VERSION## - version="2.25a", + version="2.26a", ##VERSION## author="Dave Kuhlman", author_email="dkuhlman@davekuhlman.org", diff --git a/tutorial/generateds_tutorial.html b/tutorial/generateds_tutorial.html index fc814ab5c9dff342cf0cce1a64e8c5fd1f50a8ff..1aa034103fc9040d0c8ea6b86fcbad1b5dd3f6d5 100644 --- a/tutorial/generateds_tutorial.html +++ b/tutorial/generateds_tutorial.html @@ -219,7 +219,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.25a</td> +<tr class="field"><th class="field-name">revision:</th><td class="field-body">2.26a</td> </tr> </tbody> </table> @@ -228,7 +228,7 @@ They are used by updateversion.py. --> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> -<tr class="field"><th class="field-name">date:</th><td class="field-body">March 21, 2017</td> +<tr class="field"><th class="field-name">date:</th><td class="field-body">April 28, 2017</td> </tr> </tbody> </table> @@ -1210,7 +1210,7 @@ named <tt class="docutils literal">garden_api.py</tt>, you can create an instanc <div class="footer"> <hr class="footer" /> <a class="reference external" href="generateds_tutorial.txt">View document source</a>. -Generated on: 2017-03-21 19:50 UTC. +Generated on: 2017-04-28 21:54 UTC. Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source. </div> diff --git a/tutorial/generateds_tutorial.txt b/tutorial/generateds_tutorial.txt index 579236f1d1f31e314748d96700d734c61df1dcf9..ec5b5db503d55caf53b2db5efe822caa530babf9 100644 --- a/tutorial/generateds_tutorial.txt +++ b/tutorial/generateds_tutorial.txt @@ -11,7 +11,7 @@ generateDS -- Introduction and Tutorial .. version -:revision: 2.25a +:revision: 2.26a .. version diff --git a/tutorial/generateds_tutorial.zip b/tutorial/generateds_tutorial.zip index d8a4a2e108e95ab0d368063584e83ff7d400323a..5ac7b6ccf4e3a8b441ef4d6e00a77c913ecfe37a 100644 Binary files a/tutorial/generateds_tutorial.zip and b/tutorial/generateds_tutorial.zip differ