diff --git a/README b/README index e4bfc74c07925db0191f6c938932bd6da955723e..6cead5c651ca88655cb61b6a346f8d5e4cf29862 100644 --- a/README +++ b/README @@ -141,10 +141,16 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Change history -------------- -Version2.17b (08/05/2015) +Version2.18a (08/13/2015) - Fix to regex pattern used to capture "<![CDATA[ ... ]]>". The old pattern was dropping ending characters when the content contained HTML/XML markup. Thanks to Adrian Cook for this fix. +- Merged use of replacement patterns in cleanupName. With this fix + users can specify patterns to look for and replacements strings to + be used to clean up special characters and other patterns in + names. There are some notes in the document; search for + "cleanup-name" in generateDS.html. Thanks to Fedor Tyurin for + this fix. Version 2.17a (05/28/2015) - Modified setup.py so that process_includes.py is installed where diff --git a/generateDS.html b/generateDS.html index 1963c99de903a75718b93000f1ba7e239d859263..0c8c03f890de485c2bc33852bbdd71b50a0406c1 100644 --- a/generateDS.html +++ b/generateDS.html @@ -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">May 21, 2015</td> +<tr class="field"><th class="field-name">date:</th><td class="field-body">August 13, 2015</td> </tr> </tbody> </table> @@ -615,6 +615,12 @@ Options: to XML) Example: "write etree" Default: "write" + --preserve-cdata-tags Preserve CDATA tags. Default: False + --cleanup-name-dict=<replacement-map> + Specifies replacement pairs when cleaning up + names. + Example: "{':': 'colon', '-': 'dash', '.': 'dot'}" + Default: "{':': '_', '-': '_', '.': '_'}" -q, --no-questions Do not ask questions, for example, force overwrite. --session=mysession.session @@ -848,6 +854,16 @@ and use any of lxml's other capabilities.</li> <p class="last">For example: <tt class="docutils literal"><span class="pre">--export="write</span> etree"</tt> and <tt class="docutils literal"><span class="pre">--export="write"</span></tt>. The default is: <tt class="docutils literal"><span class="pre">--export="write</span> literal"</tt>.</p> </dd> +<dt>preserve-cdata-tags</dt> +<dd>Preserve CDATA tags. Normally, CDATA tags ("<![CDATA[ ... ]]>") +are dropped while parsing an XML instance document. If this +option is included, the generated code will preserve those tags +and will write them out during export. The default is False.</dd> +<dt>cleanup-name-dict=<replacement-map></dt> +<dd>Specifies replacement pairs to be used when cleaning up names. +Must be a string representation of a Python dictionary. +Example: <tt class="docutils literal"><span class="pre">{':':</span> 'colon', <span class="pre">'-':</span> 'dash', <span class="pre">'.':</span> 'dot'}</tt>. +Default when omitted: <tt class="docutils literal"><span class="pre">{':':</span> '_', <span class="pre">'-':</span> '_', <span class="pre">'.':</span> '_'}</tt>.</dd> <dt>q, no-questions</dt> <dd>Do not ask questions. For example, if the "-f" command line option is omitted and the ouput file exists, then generateDS.py @@ -3038,7 +3054,7 @@ following among others:</p> <div class="footer"> <hr class="footer" /> <a class="reference external" href="generateDS.txt">View document source</a>. -Generated on: 2015-05-21 18:14 UTC. +Generated on: 2015-08-13 20:46 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.txt b/generateDS.txt index faadf2e9e4f778f31f41eafa1435103a0ca742be..ee16bb8cd2fd4cca2700577af0f6e2d4653c681f 100644 --- a/generateDS.txt +++ b/generateDS.txt @@ -309,6 +309,12 @@ Here is the usage message displayed by ``generateDS.py``:: to XML) Example: "write etree" Default: "write" + --preserve-cdata-tags Preserve CDATA tags. Default: False + --cleanup-name-dict=<replacement-map> + Specifies replacement pairs when cleaning up + names. + Example: "{':': 'colon', '-': 'dash', '.': 'dot'}" + Default: "{':': '_', '-': '_', '.': '_'}" -q, --no-questions Do not ask questions, for example, force overwrite. --session=mysession.session @@ -565,6 +571,25 @@ export For example: ``--export="write etree"`` and ``--export="write"``. The default is: ``--export="write literal"``. +preserve-cdata-tags + Preserve CDATA tags. Normally, CDATA tags ("<![CDATA[ ... ]]>") + are dropped while parsing an XML instance document. If this + option is included, the generated code will preserve those tags + and will write them out during export. The default is False. + +cleanup-name-dict=<replacement-map> + Specifies replacement pairs to be used when cleaning up names. + Must be a string representation of a Python dictionary. The + keys and values in this dictionary must be strings. The + intension is to enable us to replace special characters in names + that would cause the generation of invalid Python names, for + example the names of generated classes. However, since a simple + string replacement is performed, you can replace any single + character or sequence of characters by any other single + character or sequence of characters. Example: ``{':': 'colon', + '-': 'dash', '.': 'dot'}``. Default when omitted: ``{':': '_', + '-': '_', '.': '_'}``. + q, no-questions Do not ask questions. For example, if the "-f" command line option is omitted and the ouput file exists, then generateDS.py @@ -652,6 +677,17 @@ generateDS.py modifies the name of the attribute by adding "_attr" to its name. +Cleaning up names with special characters etc. +................................................ + +``generateDS.py`` attempts to clean up names that contain special +characters. For example, a complexType whose name contains a dash +would generate a Python class with an invalid name. But, you can +use this facility to make other changes to names as well. See the +notes on the command line option ``--cleanup-name-dict`` for more on +this. + + The graphical user interface -- How to use it ==============================================================