README.rst 99.3 KB
Newer Older
1
2
3
================================================
generateDS.py -- Generate Python Data Structures
================================================
dkuhlman's avatar
dkuhlman committed
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

----------
What is it
----------

generateDS.py generates Python data structures from an Xschema
document.  It generates a file containing: (1) a Python class for
each element definition and (2) parsers (which use the Python
minidom module) for XML documents that satisfy the Xschema
document.  The class definitions contain:

- A constructor with initializers for member variables.

- Get and set methods for member variables.

19
- A 'build' method used during parsing to populate an instance.
dkuhlman's avatar
dkuhlman committed
20

21
22
- An 'export' method that will re-create (write out) the XML element
  in an XML document.
dkuhlman's avatar
dkuhlman committed
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

- An 'exportLiteral' method that will write out a text (literal)
  Python data structure that represents the content of the XML
  document.


---------------------------
How to build and install it
---------------------------

De-compress the generateDS distribution file.  Use something like
the following:
 
    tar xzvf generateDS-1.5a.tar.gz

Then, the regular Distutils commands should work:

    python setup.py build
    python setup.py install


-------------
How to use it
-------------

See generateDS.html for documentation.

Produce class definitions and sub-class definitions with something
like the following:

    $ python generateDS.py -o people.py -s people_subs.py people.xsd

Here is a test using the enclosed sample Xschema file:

    $ python generateDS.py -o people.py people.xsd
    $ python people.py people.xml


----------------
More information
----------------

More information on generateDS.py is in generateDS.html
in the distribution or
`generateDS -- Generate Data Structures from XML Schema --
68
69
http://www.davekuhlman.org/generateDS.html
<http://www.davekuhlman.org/generateDS.html>`_.
dkuhlman's avatar
dkuhlman committed
70
71
72
73

There is also a tutorial.  See tutorial/tutorial.html
in the distribution or
`generateDS -- Introduction and Tutorial --
74
75
http://www.davekuhlman.org/generateds_tutorial.html
<http://www.davekuhlman.org/generateds_tutorial.html>`_.
dkuhlman's avatar
dkuhlman committed
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143


-----------
Limitations
-----------

XML Schema limitations -- There are lots of things in Xschema that
are not supported.  You will have to use a restricted sub-set of
Xschema to define your data structures.  See the documentation
(generateDS.html) for supported features.  See people.xsd and
people.xml for examples.

Mixed content -- generateDS.py generates a parser and data
structures that do not handle or represent mixed content.  Here is
an example of mixed content:

    <note>This is a <bold>nice</bold> comment.</note>

My only, and some what feeble, excuse for this is that
generateDS.py is intended for structured data rather than marked
up text.  However, whether my excuse is a good one or a feeble
one, you should be warned that if you anticipate needing mixed
text, do *not* use generateDS.py.

Large documents -- The parser generated by generateDS.py uses
minidom.  This means that the entire XML document must be read and
a DOM tree constructed in memory.  In addition, the data
structures generated by generateDS.py must occupy memory.  This
means that generateDS.py is not well-suited for applications that
read large XML documents, although what "large" means depends on
your hardware.  Notice that the 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.


-------
License
-------

Copyright (c) 2002 Dave Kuhlman

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

[MIT License -- http://www.opensource.org/licenses/mit-license.php]


--------------
Change history
--------------

144
145
146
147
148
149
150
151
152
153
154
155
156
Version 2.29.25 (10/05/2018)

- Added a section to the documentation (generateDS.txt) for types
  derived by extension, i.e. types that use the xsi:type attribute
  in the XML instance document.  Thanks to Justin McManus for
  motivating me to learn about this and for providing guidance and
  pointers along the way.
- Added a unit test for types derived by extension.
- Converted unit tests so that we can use Python 3 not Python 2.
- Changes in ``generateDS.py`` so that it uses the ``six``
  compatibility library to handle the ``urllib`` name changes
  between Python 2 and 3.

157
158
159
160
161
162
163
164
Version 2.29.24 (08/27/2018)

- Changed name of parameter in the export method from "namespace_"
  to "namespaceprefix_" in an attempt to reduce confusion about its
  use.  It's value, if it has one, should be something like "abc:".
  Thanks to Bernd Zimmermann for his advice and encouragement on
  this.

165
166
167
168
169
170
171
172
173
174
Version 2.29.23 (08/16/2018)

- Added new command line option "--create-mandatory-children".  If a
  child is defined with minOccurs="1" and maxOccurs="1" and the
  child is xs:complexType and the child is not defined with
  xs:simpleContent, then in the element's constructor generate code
  that automatically creates an instance of the child.  Thanks to
  Vincent Helfre for analyzing this issue and providing guidance
  toward a solution.

175
176
177
178
179
180
181
182
183
Version 2.29.22 (08/03/2018)

- Fixed exception that occurs when (1) an xs:complexType is defined
  with an attribute and a child that have the same name and (2) the
  "-a" command line flag is used to specify a schema namespace
  prefix other than the default (e.g. generateDS.py -a "xsd:" ...).
  Thanks to Daniel Ramirez for tracking down and analyzing this
  issue.

184
185
186
187
188
189
Version 2.29.21 (08/02/2018)

- Fix to use of simpleType name.  Needed to do cleanupName() on the
  class name.  Thanks to Daniel Ramirez for reporting this and for
  suggesting a fix.

190
191
192
193
194
195
196
197
198
199
200
Version 2.29.20 (07/30/2018)

- Fix to generation of regular expression used to validate a
  simpleType.  Before this fix, we were replacing "|" with "$|^" to
  implement alternatives in a test.  By removing that replacement,
  we leave it up to the author of the schema to encode that test of
  alternatives into the regular expression.  Thanks to Bernd
  Zimmermann for reporting this issue.
- Fixes to formatting of xs:dateTime.  Thanks to Tim Hulst for this
  fix.

201
202
203
204
205
206
207
208
Version 2.29.19 (07/20/2018)

- Merged pull request that makes generated enums for each simpleType
  uppercase.  Thanks to Mustafa Şenol Coşar for this enhancement.
- Added new command line option "--mixed-case-enums" to control
  whether simpleType enums are changed to upper case.  The default
  is True.

209
210
211
212
213
Version 2.29.18 (07/19/2018)

- Fixes to the example code underneath `Demos/`.  Thanks to Witold
  Jarzynka for reporting this.

214
Version 2.29.17 (07/11/2018)
215
216
217
218
219
220
221

- Merged pull request that generates enum classes for each simpleType.
  Thanks to Mustafa Şenol Coşar for this enhancement.
- Fix to generatedssuper.py -- (1) Added `on_delete` to Django
  ForeignKey declarations.  (2) Added relative import (dot) to
  generated admin.py.

222
223
224
225
226
227
228
229
230
231
232
233
Version 2.29.16 (06/21/2018)

- Added dependencies to ``setup.py``.  Thanks to Laszlo for this
  suggestion.
- Fixes to specifying character encodings.  We now read XML schema
  files in binary mode.  (2) We now use the value of
  --external-encoding only when a generated module is run under
  Python 2 (not Python 3); we use it to encode the XML instance
  document; if --external-encoding was not used, then we use
  "utf-8" to encode exported XML.  Thanks to Laszlo for his
  guidance on this.

234
235
236
237
238
239
240
241
242
Version 2.29.15 (05/16/2018)

- Fixed issue related to use of command line flag
  --preserve-cdata-tags: when the generated regex pattern was not
  matched (returned None), created an exception.  Added a test for
  None.  Also, required conversion of bytes to str before the
  pattern match for Python 3.  Thanks to Lavanya Poondru for
  reporting this and helping with a fix.

243
244
245
246
247
248
Version 2.29.14 (05/08/2018)

- Fixes to logging in generateDS.py -- (1) Setup logging only when
  running as script.  (2) Use named logger instead of root one.
  Thanks to Andrei Fokau for this fix.

249
250
251
252
253
254
Version 2.29.13 (05/08/2018)

- Merged PR from Andrei Fokau.  Fix tests by striping varying lines.
  Also add config for Travis CI.  Thanks to Andrei for this
  enhancement.

255
256
257
258
259
260
Version 2.29.12 (04/23/2018)

- Patch to compute the fully qualified name of the simple types
  before resolving the built-in base type.  Thanks to Alim Gokkaya
  for this fix.

261
262
263
264
265
266
267
Version 2.29.11 (03/16/2018)

- Fix for the --no-namespace-defs command line option.  The work on
  namespaces in v. 2.29.6 appears to have conflicted with and
  deactivated this.  Thanks to Olof Kindgren for reporting this.
- Added unit test for --no-namespace-defs.

268
269
270
271
272
273
274
Version 2.29.10 (03/14/2018)

- Fix to resolution of child types -- Formerly, we were adding some
  unnecessary and unwanted entries to `fqnToElementDict`, which
  caused the look-up to get the wrong type.  Thanks to Olof Kindgren
  for guiding me through this.

275
276
277
278
279
280
281
282
Version 2.29.9 (03/02/2018)

- Added command line flag --always-export-default
  (AlwaysExportDefault).  When used, the generated module will
  always export attributes with a default value even when the
  current value is equal to the default value.  Thanks to Marc
  Capavanni for suggesting this.

283
284
285
286
287
288
289
290
291
292
293
Version 2.29.8 (03/02/2018)

- Added a change so that an attribute specified as `fixed` will be
  handled in the same way as one specified as `default`.  This
  leaves it to the user to validate and enforce the `fixed`
  restriction in some other way, e.g. through use of an XML
  validating parser such as `xmllint`.  Thanks to Sanja Abbott for
  suggesting this enhancement.
- Various fixes for string/unicode differences across Python 2 and
  Python 3.

294
295
296
297
298
299
300
301
Version 2.29.7 (02/05/2018)

- Fix for unicode error that occurs during simpleType validation
  under Python 2.7.  Thanks to Juha Tuomala for reporting this issue.
- Added a test for xs:simpleType validation that uses a pattern
  containing a multi-byte character.

Version 2.29.6 (01/22/2018)
302
303
304
305
306
307
308
309
310

- Fix to generation of namespace prefix in export methods.  With
  this fix, process_includes.py collects information about which
  xs:element and xs:complexType definitions are in which target
  namespaces.  Then generateDS.py uses that dictionary to generate
  export methods that produce the namespace prefix.  Thanks to Rob
  Calvert for identifying this problem and for helping me to
  understand it.

311
Version 2.29.5 (01/17/2018)
312
313
314
315
316
317
318

- Fix to prevent infinite recursion that happens when a simple type
  is defined whose name is the same as it's restriction base type
  except for the namespace prefix.  Thanks to Nicolas de Saint Jorre
  for reporting this problem and for providing a schema that
  reproduces it.

319
320
321
322
323
324
325
326
327
328
329
Version 2.29.4 (12/14/2017)

- Fix for exporting the child of an element, when that child is
  declared as an instance of an abstract type (abstract="true" in
  the schema).  When exporting, the type of the child needs to be
  determine at runtime through polymorphism.  This fix prevents the
  containing (parent) object from passing the name of the abstract
  class to the instance of the concrete class when calling its
  export function.  Thanks to Rob Calvert for reporting this and for
  his analysis that helped me understand the problem.

330
331
332
333
334
335
336
337
338
339
340
341
342
Version 2.29.3 (12/11/2017)

- Resolved an issue with a type casting problem that occurs when a
  numeric default value is provided as default for an xsd:attribute.
  Normally attributes were being type casted at the constructor to a
  Python type if the types are one of the builtins. However
  attributes derived from a builtin type via xsd:simpleType
  definitions couldn't be casted to a base type and were being
  treated as strings.  Refactored out the simple type resolution
  from the XsdElement class to a function so that we can reuse the
  same code for both elements and attributes.  Thanks to
  Alim Gokkaya for fixing this and for providing a pull request.

343
344
345
346
347
Version 2.29.2 (12/07/2017)

- Fix for use of StringIO in generated subclass modules.  Thanks to
  Rohan Dsa for alerting me on this.

348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
Version 2.29.1 (12/07/2017)

- Fix to generation of code to export child elements that have
  default values.  When the element's value is equal to the default
  value, the export of the element should be omitted only if the
  element is optional (i.e. minOccurs=0).  Thanks to Andrii Iudin
  for reporting this.
- Several modifications to use the `six` module as a cleaner way to
  smooth over differences between Python 2 and Python 3.
- Added file generateds/django/README.txt containing instructions on
  running the Django code generation support.  Thanks to Christian
  González for reporting problems with this and for providing
  information that helped understanding the source of the
  difficulties.

363
364
365
366
367
368
Version 2.29.0 (11/28/2017)

- Fixes to export of namespace prefixes for schemas that are
  imported.  Thanks to Bob Barcklay for reporting this and for
  advise on fixes.

369
370
371
372
373
374
375
Version 2.28.2 (10/27/2017)

- Changed name/version number scheme to all numeric with dots.
  Required by setuptools or the Python Package Index.
- Accepted and merged pull request by Eugene Petkevich that fixes
  export of elements with mixed content.  Thank you Eugene.

376
377
378
379
380
381
382
383
384
385
Version 2.28d (10/25/2017)

- Fix for incorrect resolution of type for a child element type
  defined with <xs:element ref="Abc"/>.  The ref= can refer to a
  global (top level) xs:element rather than an xs:complexType, in
  which case we need to use the type= to determine the
  xs:complexType.  Thanks to Bob Barcklay and Olof Kindgren for
  reporting this issue and for working with me on this and helping
  to track down the fix.

386
387
388
389
390
391
392
393
394
Version 2.28c (10/17/2017)

- Fix for generation of GDSClassesMapping dictionary.  Formerly, we
  were generating entries in this dictionary for some xs:element
  items that were not at top level.  Fixed so that only xs:element
  items at top level (immediately under the root/schema node) are
  included in this dictionary.  Thanks to Christin Gunning for
  reporting this and for guiding me on this change.

395
396
397
398
399
400
401
402
403
404
405
406
407
408
Version 2.28b (08/22/2017)

- Fix for Django models and forms generation -- "float" data type
  was being mapped and was not treated as a simple data type.
  Thanks to Sriram Sundar for catching and reporting this.
- Sriram also requested that in the Django models and forms
  generation, we be able to omit the "_model" and "_form" suffix on
  generated class names.  There is now a "--no-class-suffixes"
  command line option accepted by both gends_run_gen_django.py
  and gends_generate_django.py to do that.  Thanks to Sriram for
  this suggestion.
- Added Python version to the information in the comments at the top
  of generated modules.

409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
Version 2.28a (06/23/2017)

Significant work by Alim Gokkaya.  Thank you, Alim.

Here's a summary of what's been changed:

- Added new command-line options:

  - ``--disable-xml``: Toggles the generation of XML serialization
    related code
  - ``--disable-generatedssuper-lookup``: Disables generation of the
    try-except lookup for a `generatedssuper` module
  - ``--use-source-file-as-module-name``: Sets the source XSD file name as
    the target module name in the one file per XSD mode

- Retained ``xsd:choice`` related information in the generated class
  ``MemberSpec``.
- Retained the original XML schema attribute definitions in the generated
  class members.
- Fixed generation of ``import`` statements for the base classes.
- Fixed class not being generated when parent class is defined in
  another XML schema file.
- Fixed fqn-module mapping being unavailable for the classes defined
  in imported XML schema files.
- Fixed attribute names are sometimes not cleaned-up from the prefix
- Fixed ``xsd:simpleType`` validations methods are not being generated in
  ``one-file-per-xsd`` mode.
- Fixed equality check against objects defining extra attributes.
- Added unit test for command line options ``--disable-xml`` and
  ``--disable-generatedssuper-lookup``.

440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
Version 2.27b (06/09/2017)

- Fixed a bug that occurred when an element definition contains a
  child defined as xs:any.  The member spec (``MemberSpec_``) was not
  generated with the correct name.  Also in the django support,
  added a temporary fix for xs:any child elements.  Thanks to Rémy
  Gibault for reporting this.
- Django support -- Models in django are case insensitive.  That
  means that if a schema defines multiple element types that differ
  only in case, and we generate two models that differ only in case,
  django says it's an error.  So, implemented a facility which,
  when multiple names differ only in case, adds a suffix so that
  those names will be unique even when case is ignored.  Again,
  thanks to Rémy for finding and reporting this.
- Django support: (1) Added a test and more explanatory error
  message for the case where gends_generate_django.py was failing to
  import the correct version of module generatedssuper.py.  (2)
  Created a mapping so that all generated model and form names are
  unique even when case is ignored.  (3) Added a name mapping to
  avoid clashes with Python keywords.

Dave Kuhlman's avatar
Dave Kuhlman committed
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
Version 2.27a (06/01/2017)

- Fixed bug in gends_extract_simple_types.py that caused an
  exception when the simpleType name has a namespace prefix.
  Thanks to Rémy Gibault for reporting this.
- Added two utilities that can be used to replace the capability
  invoked by the --one-file-per-xsd command line option.
  utils/collect_schema_locations.py can be used to collect and write
  out the top level schema locations.  batch_generate.py can be used
  to (read the output from collect_schema_locations.py and generate
  modules.  Use --help to obtain more information from each of
  these.  For instructions on this, see the docs and also the README
  in the utils/ subdirectory.
- Various fixes for the generation of namespace prefix definitions
  when the generated export functions are called.  Thanks to Eugene
  Petkevich for reporting and working with me on this.
- Added command line option --no-namespace-defs to force export
  functions to not added namespace prefix defintions.
- Added ability for generated modules to import a module
  (generatedsnamespaces.py) containing a dictionary
  (GenerateDSNamespaceDefs) that maps element type names to the
  namespace prefix definitions (or any XML attributes, actually)
  that are to be added to specific elements during export.  See the
  docs and also notes near where generatedsnamespaces.py is imported
  in a generated module.
- Fixed an error in gends_run_gen_django.py which caused it to fail
  when generateDS.py produced a warning message.  Thanks to Rémy
  Gibault for catching and reporting this.
- Added a utility to help with analyzing complex schemas.
  utils/show_schema_hierarchy.py can by used to show an indented
  hierarchy of schemas that are pulled in by xs:include and
  xs:import elements.  Type `utils/show_schema_hierarchy.py --help`
  for more info.  Also see the docs.

495
Version 2.26a (05/09/2017)
496
497
498
499
500
501
502
503
504

- 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.
505
506
- Moved README to README.rst so that hopefully Bitbucket will
  render it as reStructuredText (with Docutils).  Also, fixed a
507
508
509
510
511
512
  number of reST/Docutils errors in README.rst.
- Another fix for unicode encoding in process_includes.py.
- A bug was uncovered when the "-o" command line option is omitted
  and the Python version is 3.  Added a check that forces the use of
  the "-o" option unless the one-per option is included.  Thanks to
  Oskari Petas for reporting this.
513

514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
Version 2.25a (03/21/2017)

- Fixes to the Django support for Python 3.  Thanks to Shane Rigby
  for all his help with all of these changes to the Django code.
- Added `optional` to the MemberSpec so that when command line
  option "--member-specs" is "dict" or "list", the generated code
  specifies whether the member is optional or not.
- In the Django support, `django/gends_run_gen_django.py` now has
  new option "-s" ("--script") that can be used to write out the
  command lines used internally by `django/gends_run_gen_django.py`.
  This new flag can be used to generate a shell script that can be
  run instead of `django/gends_run_gen_django.py`.  (Note: The
  script might require a minor edit or two.)
- In the Django support, there is now some attempt to treat optional
  members specially and to generate "blank=True, null=True," in the
  `models.py` file.
- Fix to Django support so that we generate *unique* names for
  `related_name`.
- Added several date/time types for Django support: 'gYear',
  'gYearMonth', 'gMonth', 'gMonthDay', 'gDay',


536
Version 2.24b (01/02/2017)
537
538
539
540

- Added several fixes to generateDS.py and process_includes.py that
  are needed for the support for Python 3.  Thank you Ian Glover for
  catching this and for contributing the fixes.
541
542
543
544
545
546
547
- Fixed bug in generation of regular expression for validating
  pattern in a restriction on a simpleType.  In the pattern, we
  needed to replace "|" with "$|^", unless the vertical bar was
  escaped with a backslash.  This was necessary so that each regular
  expression separated by a vertical bar would be anchored at the
  left and right.  Thanks to Clint Pitzak for catching and reporting
  this.
548
549
- Modified the Django support (in ./django/) so that it will run
  under Python 3.  Thanks to Shane Rigby for reporting this problem.
550
- Fixed an error in encoding unicode ``valueOf_`` for  <xs:complexType 
551
552
  <xs:simpleContent> <xs:extension base="xs:string">.  Thanks to
  Andrii Iudin for catching this.
553

Dave Kuhlman's avatar
Dave Kuhlman committed
554
Version 2.24a (11/16/2016)
555
556
557
558
559

- Added entry_points to setup.py so that distutils will generate
  executable scripts for executable .py files (for example,
  generateDS.py and process_includes.py).  Thanks to Michael Jenny
  for suggesting this and for showing the way to do it.
560
561
562
- Fixed function call signature mismatch in MixedContainer call to
  export method.  Thanks to Lev Israel for catching this and
  providing the solution.
Dave Kuhlman's avatar
Dave Kuhlman committed
563
564
565
566
567
568
569
570
571
572
573
574
575
576
- Added "remove duplicate elements" fix to catch duplicate
  definitions of child elements with the same name inside a single
  parent element.  This fix does the following: (1) removes
  duplicate child; (2) makes the remaining child a Python list
  (effectively maxOccurs="unbounded"); (3) prints a warning message
  when it finds and removes a duplicate.  Thanks to Pietro Saccardi
  for catching and reporting this.
- More fixes for "remove duplicate elements".
- Removed command line option for "remove duplicate elements".  This
  behavior will now always be performed.
- Added unit test for "remove duplicate elements".
- Added command line option "--no-warnings" to turn off warning
  messages.  I needed it for the unit test for "remove duplicate
  elements".
577

578
579
580
581
582
583
584
Version 2.23b (09/26/2016)

- Added missing unit test files to build (MANIFEST.in).
- Fixed exception that occurs when character content is empty for an
  element defined as type xs:token.  Thanks to Andrii Iudin for
  reporting and checking this.

Dave Kuhlman's avatar
Dave Kuhlman committed
585
586
587
588
589
590
591
592
593
Version 2.23a (09/14/2016)

- Integrated Clayton Daley's fixes to the unit tests.  Thanks much,
  Clayton.
- Clayton's fixes to the unit tests uncovered several errors that
  had been masked and hidden.  Fixed those errors, for example: (1)
  eliminated generation of erroneous call to validation method; (2)
  added catalog file.

594
595
596
597
598
599
600
601
Version 2.22c (04/26/2016)

- Fixes to generation of validation methods for xs:date, xs:time,
  and xs:dateTime simpleType.  Thanks to Andrii Iudin for reporting
  this and for suggesting a solution.
- Added additional unit tests for validations of xs:date, xs:time,
  and xs:dateTime simpleType.

602
603
604
605
606
607
Version 2.22b (04/20/2016)

- Fixed endless recursion that occurred while attempting to replace
  attribute group names.  Thanks to Bing Wang for reporting this and
  for identifying and providing the XML schema that reproduced it.
- Fixed failure to clean up names containing special characters in
608
  function generateBuildStandard_1.  This error was uncovered
609
610
  when generating code from Bing Wang's schema.  Thanks again Bing.

611
612
613
614
615
616
617
618
619
Version 2.22a (04/11/2016)

- Added support for additional command line options to
  generateds_gui.py.  Added analogous support to generateDS.py for
  use of session files produced by generateds_gui.py.
- There is now a bit of documentation with a few usage notes on
  generateds_gui.py.  See generateds_gui_notes.txt and
  generateds_gui_notes.html.

620
621
622
623
624
625
626
627
Version 2.21a (04/01/2016)

- The GUI (graphical) front end to generateDS.py has been
  resuscitated and is now working again thanks to Aleksandr
  Dragunkin.  
  The GUI front end must be run under Python 3, and you must install
  Python support for Gtk.
  Aleksandr has also provided a Russian translation of the labels
628
  etc in the user interface.  You can run that with::
629
630
631
632
633
634
635
636
637
638
639
640
641

      $ cd /path/to/generateds/gui
      $ python3 generateds_gui.py --impl-gui=generateds_gui_ru.glade

  Note that the GUI interface still lacks support for a few of the
  command line options that were added most recently to
  generateDS.py.  If you need one or more of those missing options
  but would still like to use the GUI front end, you can consider
  using the "Capture CL" under the Tools menu, and then copy and
  paste the result into a shell script, add any needed options to
  that script, and run the script from the command line.


Dave Kuhlman's avatar
Dave Kuhlman committed
642
643
644
645
646
647
648
649
650
Version 2.20b (03/28/2016)

- Fixes to handling of simpleType with and without restrictions on
  another defined simpleType.  These were not being handled
  correctly when the name of the simpleType contained a dash.
  Thanks to Ryku for identifying this problem and for a very helpful
  description of what was wrong and for providing schemas to
  reproduce the problem.

Dave Kuhlman's avatar
Dave Kuhlman committed
651
Version 2.20a (02/25/2016)
652
653
654
655
656
657

- Another patch for Python 2 and 3.  We needed to protect against
  performing an encoding that caused an exception in generateDS.py
  and process_includes.py.  Thanks to Marcus Schäfer for catching
  this and for providing a fix.

658
659
660
661
662
663
664
Version 2.19b (02/16/2016)

- Modified generated code so that it will run under both Python 2
  and Python 3.  There is no longer any need to generate different
  code for Python 2 and Python 3.  If fact, the "--py3" command line
  option has been removed.

665
Version 2.19a (02/08/2016)
666
667

- Added the ability to generate code that can run under Python 3.
Dave Kuhlman's avatar
Dave Kuhlman committed
668
669
  Use the "--py3" command line option.  Note that if you generate
  code for Python 2 (the default), then you must run that generated
670
671
672
673
  code under Python 2.  And, if you generate code for Python 3,
  then you must run that generated code under Python 3.  There is
  currently no way to generate code that will run under both Python
  2 and Python 3.
Dave Kuhlman's avatar
Dave Kuhlman committed
674
675
- Modifications so that generateDS.py itself can be run with either
  Python 2 or Python 3.
676
677
678
- Fixed the template (TEMPLATE_HEADER) so that it uses the format
  function and keyword arguments.
- Added info on --py3 command line option to doc (generateDS.txt).
679
680
681
682
683
684
685
686
- Added new script (fix_subclass_refs.py) that can be used to fix-up
  (change) which subclass file (of two or more that were generated
  with the -s command line option) is used by the superclass file
  when parsing an XML instance document.  This will enable you to
  use the -s option to generate multiple subclass files, add
  different code to each of them, and then parse documents and
  create instances of classes from one then another during the same
  run.  But also, see next item.
687
688
- Added generation of code to lookup the subclass of a generated
  class using a global variable containing the subclass module.
689
690
691
692
693
694
  This provides an alternative and more convenient way to do the
  above (i.e., use fix_subclass_refs.py to select from multiple
  subclass files generated with the -s command line option).
  However, there may be tasks that can be performed with that script
  or a modified version of it that cannot be done with this approach
  using a global variable.  Here is a sample script that uses this
695
  option::
696

697
698
699
700
701
702
703
704
705
706
707
      import tmp01suba
      import tmp01subb
      def test():
          tmp01suba.supermod.CurrentSubclassModule_ = tmp01suba
          roota = tmp01suba.parse('test01.xml', silence=True)
          tmp01subb.supermod.CurrentSubclassModule_ = tmp01subb
          rootb = tmp01subb.parse('test01.xml', silence=True)
          roota.show()
          print '-' * 50
          rootb.show()
      test()
708
709

Version 2.18a (12/16/2015)
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725

- Fixed quoting of simpleContent so that, e.g., "&amp;" is exported
  as "&amp;" and not as "&".  Thanks to Ardan Patwardha for
  reporting this and contributing a fix.
- Fix to generation of exportAttributes so that the test for already
  generated is properly quoted.  Thanks to Naresh Shenoy for
  reporting this and for contributing a fix.
- Another fix related to the unquoted constant in exportAttributes.
  A simple fix had a bad conflict.  Thanks to Christian Rasmussen
  for focusing my attention on this one.
- Fix for xs:simpleContent that extends type xs:float (or xs:integer
  or other numeric types).  When set to numeric zero (for example,
  after parsing the instance doc), the value was not being exported.
  Thanks to Ardan Patwardhan for diagnosing this and for
  contributing the fix.

726
Version 2.17a (08/17/2015)
727

728
729
730
731
732
- Modified setup.py so that process_includes.py is installed where
  it can be imported.
- Changed default settings for export -- Default is now to generate
  only the normal export methods, instead of both normal and
  literal.  See command line option --export.
733
734
735
- 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.
736
737
738
739
740
- 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
741
742
743
  suggesting and implementing this enhancement.
- Added unit test for enhanced cleanupName.  Added documentation to
  generateDS.txt.
744

745
Version 2.16a (05/28/2015)
746

747
748
- Added new command line option ("--preserve-cdata-tags") that
  causes generation of code that contains a special parser to retain
749
750
751
752
  CDATA tags.  Thanks to Adrian Cook for reporting this, for
  providing test data and test cases, and for help with testing and
  feed-back.
- Added ability for user to specify the names of classes generated
753
754
755
756
757
758
759
  from anonymous, nested xs:complexType definitions, rather than
  accept the names created in process_includes.py.
- Added a unit test for the anonymous, nested definition capability.
- Fix to error caused by check (in generated code) for whether lxml
  or ElementTree is being used.  We no longer support use of
  ElementTree.  Thanks to Emil Nordling for catching and reporting
  this.
760

761
Version 2.15b (04/07/2015)
762

dkuhlman's avatar
dkuhlman committed
763
764
- Fix to generation of simpleType validation code for list (unbounded)
  elements.  Thanks to wobanator for this fix.
765
766
767
- Fix to code for --one-file-per-xsd.  Added check to avoid an
  infinite loop schemas not suitable to --one-file-per-xsd.  Thanks
  Michael Vezie for catching this and for identifying relevant
768
769
  location in the code.  And, thanks to George David for providing a
  better fix than mine.
770
771
772
773
774
- Enhancement so that child elements defined with a default value
  will not export when the current value and the default value are
  the same.  Also added equivalent changes for attributes.  Thanks
  to Jan Biel for finding and reporting this.
- Added unit tests for the above default value enhancement.
dkuhlman's avatar
dkuhlman committed
775

dkuhlman's avatar
dkuhlman committed
776
Version 2.15a (02/18/2015)
777

778
779
780
781
782
- Modifications so that we generate code that can be used by Python 3.
  Thanks much to Richard Gerkin for this work.
- Removed possible use of ElementTree.  Lxml is now a requirement
  for both running generateDS.py itself and for running the
  generated code.
dkuhlman's avatar
dkuhlman committed
783
784
785
786
- Fixed exporting of text content so that, when it contains CDATA
  sections, the mark-up characters inside the CDATA sections are not
  escaped.  Thanks to George David for reporting this and for
  helping with a fix.
787

dkuhlman's avatar
dkuhlman committed
788
Version 2.14a (11/26/2014)
789

dkuhlman's avatar
dkuhlman committed
790
791
- Fixed export of simpleType lists (added "' '.join(data)".  Thanks
  to Per Rosengren for catching this.
792
793
794
- Added new style validation of simpleType data.  Validation
  requirements are captured from the XML schema definition of the
  simpleType, e.g. 'restriction base="..."' etc.  Thanks to
795
  azer gh for implementing much of this extended capability.
796
797
- Added unit test for simpleType validation, including test for
  proper detection of bad (invalid) data.
798
799
800
801
802
803
804
805
- Did some code cleanup with the help of the flake8 code checker.
- Added a fix so that attribute declarations that use ref= rather
  than type= will also be generated with the specific type.  Thanks
  to Florian Wilmshoever for catching and reporting this and for
  providing an XML schema as a test case.
- Added unit test for reference to simpleType.
- Fix to generation of names of substitutionGroup.  The namespace
  prefix was not being stripped in some cases.
dkuhlman's avatar
dkuhlman committed
806

dkuhlman's avatar
dkuhlman committed
807
Version 2.13a (09/09/2014)
808

809
810
811
- Minor fix to function generateToEtreeChildren.  Must generate
  call to get_valueOf only when defined (i.e. when element is
  simpleContent or isMixed).
dkuhlman's avatar
dkuhlman committed
812
813
814
815
- Fix to generation of class name prefixes added with the "-p"
  command line option.  This fix was added by Christian Ascheberg.
  Thank you Christian.
- Added unit test for class name prefixes command line option.
816

817
Version 2.12f (08/12/2014)
818

819
820
821
822
823
824
825
- Fix for substitutionGroup conflict with keyword name mapping.
  Thanks to Leonid Minchin for finding and helping with this
  problem.
- An exception occured when an element had a documentation string
  that was short (possibly 1 character).  Fixed.  Thanks to Matthias
  Zaake for finding this and for providing a patch.

826
Version 2.12e (06/16/2014)
827

828
829
830
831
832
833
- Fix for formatting error.  Thanks to Nikolay Lavrov for catching
  this and for providing a fix.
- Fix to gds_parse_datetime().  The Python datetime module's
  datetime object uses microseconds, but xs:dateTime uses fractions
  of a second (e.g. 0.123).  Converted from decimal fraction to
  microseconds.  Thanks to Mikki Weesenaar for catching this.
834
835
836
837
- Modified behavior and names for generated method insert_xxx(which
  are generated when, e.g., maxOccurs="unbounded"), so that now we
  generate insert_xxx_at and replace_xxx_at.  Thanks to Bart
  Wagenaar for pointing out this deviation from Pythonic style.
838
839
840
841
842
843
- Function transitiveClosure in generateDS.py was susceptible to
  infinite looping.  This seemed to occur when a substitutionGroup
  contains a member with the same name as the head of the
  substitutionGroup (but in a different namespace?).  Added a test
  to stop the recursion when this occurs.  Thanks to Stuart Chalk
  for finding and reporting this.
844
845
846
- Added explanation to the documentation explaining how the source                  
  distribution (generateDS-x.xxy.tar.gz or Bitbucket) is needed for                 
  use of the Django model generation capability.                                    
847

dkuhlman's avatar
dkuhlman committed
848
Version 2.12d (04/02/2014)
849

dkuhlman's avatar
dkuhlman committed
850
851
852
853
854
855
856
857
858
859
- Fix for an infinite loop caused by inconsistent use of
  mapped/clean names with list AlreadyGenerated.  Thanks to Jerome
  Allasia for catching this and for suggesting a fix.
- Added a unit test for the use of mapped/clean names, in particular
  when one xs:complexType is an xs:extension of another.
- Changed several lists to sets for faster look-up, for example
  AlreadyGenerated, AlreadyGenerated_subclass, DelayedElements, etc.
- Cleaned up the use of functions mapName() and cleanupName() to
  avoid duplicate transformations.

860
Version 2.12c (03/28/2014)
861

dkuhlman's avatar
dkuhlman committed
862
863
- Fix for "one module per XSD file" to handle an include or import
  element that refers to a *remote* schema on the Net (i.e. the
dkuhlman's avatar
dkuhlman committed
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
  location is "http:..." or "ftp:...") rather than a file on the
  local file system.  Added ability to access include/import file
  across the Net.  Thanks to Jinquan Liu for reporting this.
- Added schema to unit test for "one module per XSD file" that is
  read from remote site (http://www.davekuhlman.org).
- Fix to process_includes.py -- When run directly from the command
  line (as opposed to imported and called from another python
  module), the fixtypenames option was not being intialized.
- Fix for error in order of generation of classes that have
  superclasses.  When an anonymous simpleType occured, the name of
  the enclosing complexType was used, which caused generateDS.py to
  believe that the superclass had already been generated.  Thanks
  again to Jinquan Liu for reporting this issue.
- Fix for handling of xs:substitutionGroup -- Namespace prefix was
  causing gDS to fail to match on substitutionGroup name.
- Added code so that an instance of a generated class can remember
  the tag from which it was built.  This is needed for instances of
  a class that represents an element type that is a member of a
  xs:substitutionGroup.  But, in fact, generated code now uses this
  feature to remember and export the tag name of all complex
  elements.
- Enhanced command line option --root-element so that both the root
  tag and the root class can be specified (separated by a vertical
  bar).
- Added support for the ability of an element definition to inherit
  minOccurs and maxOccurs from the xs:sequence that contains it.
890
891
- The command line options and command line arguments used to
  generate modules are now included as comments near the top of the
dkuhlman's avatar
dkuhlman committed
892
893
894
895
896
897
  generated modules.  Also included in these generated comments is
  the command line used to generate the module.  This will help
  users later to determine which XML schema and what options were
  used to generate each module, and to re-generate the module, if
  needed.  Thanks to Mikki Weesenaar for suggesting this
  enhancement.
dkuhlman's avatar
dkuhlman committed
898

dkuhlman's avatar
dkuhlman committed
899
Version 2.12b (02/10/2014)
900

dkuhlman's avatar
dkuhlman committed
901
902
903
904
905
906
- Fix to the aliasing capability.  You should now be able to alias
  one element to another, and by doing so, only generate the
  targeted alias.  See notes on generateds_config.py in the
  documentation for more on this.  Thanks to Mikki Weesenaar for
  bring up the use case that needed this.
- Additional fixes for the "one module per XSD file".  Also,
dkuhlman's avatar
dkuhlman committed
907
908
909
  creation of a unit test for this capability.  See section "One
  Per -- generating separate files from imported/included schemas"
  in the documentation for more information.  Thanks again to
dkuhlman's avatar
dkuhlman committed
910
  George David for all his work on this.
dkuhlman's avatar
dkuhlman committed
911
912
913
- Fixes to process_includes.py -- Some uses of namespace prefix xs:
  were hard-coded, whereas some XML schemas use xsd: instead of xs:.
- Various fixes to unit tests so that all unit tests pass when using
dkuhlman's avatar
dkuhlman committed
914
915
  either the cloned Mercurial repository at Bitbucket
  (https://bitbucket.org/dkuhlman/generateds) or the tar achive.
dkuhlman's avatar
dkuhlman committed
916

dkuhlman's avatar
dkuhlman committed
917
Version 2.12a (10/29/2013)
918

dkuhlman's avatar
dkuhlman committed
919
920
921
922
923
924
925
926
- A name conflict issue caused by naming anonymous types.  An
  anonymous type is a complexType that does not have a name
  attribute and that is nested inside an element that does not have
  a type attribute.  Strengthened the code that generates new,
  unique names.  And, also fixed a problem or two in the surrounding
  code.  Thanks to Shahaf Abileah for reporting this and for
  providing test files to reproduce the problem behavior.
- Created unit test for anonymous types.
927
928
929
930
- Added command line option --fix-type-names.  This may be useful if
  there are name conflicts in your XML schema, for example, because
  the schema refers to two types with the same name but in different
  namespaces.
931
932
- Ability added to generate one Python module for each XML Schema
  (.xsd file) imported/included.  Added command line options
933
934
935
  --one-file-per-xsd, --output-directory=, and --module--suffix= in
  support of this.  Thanks much to George David for implementing
  this new feature.
dkuhlman's avatar
dkuhlman committed
936
937
938
939
940
- This change provided by Logan Owen. -- Return self from build
  function of generated classes, to allow easy chaining.  The main
  use case for this change is if you have a list of xml documents,
  and you want to change them into generateDS class instances.
  Thank you Logan.
dkuhlman's avatar
dkuhlman committed
941

dkuhlman's avatar
dkuhlman committed
942
Version 2.11a (08/16/2013)
943

944
- Added ability to use XML catalog to find included/imported
dkuhlman's avatar
dkuhlman committed
945
946
947
  schemas.  The -c command line option has been added to support
  this.  Thanks to George David for implementing this enhancement.
- Added unit test for the catalog capability.
948
949
950
- Added ability to pick up the target namespace and its prefix, then
  use them in calling the export functions from the parse functions.
  Thanks to George David for suggesting this.
dkuhlman's avatar
dkuhlman committed
951
- Several fixes to formatting date and floats during export.  Thanks
dkuhlman's avatar
dkuhlman committed
952
953
954
955
  to Domenico Mangieri for catching and fixing these.
- Added generation of an extra, optional "silence" argument to the
  parse functions so that export can be turned on or off at runtime.
  Domenico is the motivator on this one, too.
dkuhlman's avatar
dkuhlman committed
956
957
958
- The information about minOccurs and maxOccurs in the generateDS
  document (generateDS.txt) was misleading or wrong.  Edited it.
  Thanks to Rinat Yangurazov for catching this.
959

dkuhlman's avatar
dkuhlman committed
960
Version 2.10b (07/22/2013)
961

962
963
964
- Changed flag for generating getters and setters.  Removed flag
  --use-old-getter-setter.  Replaced it with new flag
  --use-getter-setter, which can have the following values:
965

966
967
968
     "old" - Name getters/setters getVar()/setVar().
     "new" - Name getters/setters get_var()/set_var().
     "none" - Do not generate getter/setter methods.
969

970
971
972
  The default is "new".  See the help (use --help option) or see the
  doc (generateDS.txt/generateDS.html) for more on this.  Thanks to
  Mike Vella for suggesting this.
973
974
- Changed suffix used to prevent name conflicts with Python keywords
  from "xx" to "_".
975

dkuhlman's avatar
dkuhlman committed
976
Version 2.10a (05/29/2013)
977

978
979
980
- Added ability to produce mapping (a dict) during call to
  to_etree() that maps gDS instances to their associated etree
  elements.  Also added convenience method gds_reverse_node_mapping
dkuhlman's avatar
dkuhlman committed
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
  to reverse the order of keys and values in a mapping/dict.  See
  function parseEtree in the generated code for hints about how to
  produce these mappings.  There is also a note on generating the
  Lxml Element tree in the docs (generateDS.txt/generateDS.html).
- Python datetime.date objects don't have tzinfo, so trying to
  access it in gds_format_date was throwing an error. According to
  http://stackoverflow.com/a/610923, the best way to avoid that type
  of error is to use a try/catch for AttributeError.  Thanks to
  Logan Owen for this fix.
- Fixed bug so that gDS will now handle a simpleType nested inside a
  restriction nested inside a simpleType.  Thanks to Christian
  Kaiser for finding this, for focusing my attention on it, and for
  providing the sample files to test it with.
- Fixed bug where gDS was failing to resolve defined a simpleType
  correctly.  It was failing to add the XSchema namespace (usually
  xs:).  Thanks again to Christian Kaiser for focusing me on this
  one.
- Fixes to handling of xs:dateTime when the XML schema specifies a
  default value and the XML instance document omits the value.
  Also, fixed formatting because datetime.strftime does not handle
  dates outside of range (e.g. earlier then 19000).  Attempts to use
  a consistent internal representation across xs:dateTime, xs:date,
  and xs:time, specifically instances of datetime.datetime,
  datetime.date, and datetime.time from the Python standard library.
  Thanks to Shahaf Abileah for reporting this and for providing an
  example of the schema.  *Caution*: Because this changes the
  internal representation of dates and times used by the generated
  code, this fix may break some existing applications.
- Various fixes to generation of method exportLiteral in generated
  classes.
- More code clean-up in generateDS.py to eliminate coding style
  warnings and errors reported by flake8.  Ditto for
  process_includes.py.  Also, made a few changes to reduce the
  warnings and errors reported by flake8 when run on code generated
  by gDS.
1016

1017
Version 2.9a (02/21/2013)
1018

1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
- Added support for exporting to an Lxml element tree.  The element
  tree can then be serialized to XML, e.g. using Lxml
  etree.tostring().  This innovation is by Logan Owen, who also did
  most of the work on it (but I helped some, too).  Note that this
  work is not yet complete; it's still "work in progress"; but it
  looks very promising.
- Added --export command line option.  This enables the user to
  selectively generate export methods for any or all of normal
  export, export to etree (lxml element tree), or export to literal
  python code.  This will enable users to reduce bulk in their
  generated files when any or all of these are not needed.  The
1030
1031
1032
1033
1034
1035
1036
1037
1038
  default is "write literal", i.e. the normal export methods that we
  are used to.  Use the --help command line option or read the doc
  for a description of this option.
- Fixed a bug that occurs when a schema has an attributeGroup
  referenced with a name that includes a namespace prefix but the
  attributeGroup is defined with a name that does *not* have the
  namespace prefix.  Thanks to Mike Detecca for reporting this and
  for nudging me in the right direction when I, initially, made the
  wrong fix.
1039
- Added unit test for export to etree.
1040
1041
1042
1043
1044
1045
1046
1047
- Various fixes to the to_etree (export to Lxml element tree)
  capability: (1) fix to preserve names that contain special
  characters (e.g. "-" and "."); (2) fix to preserve the type
  attribute (xsi:type) for abstract types that whose type is set
  explicitly.  Round turn (XML --> gDS object tree --> lxml element
  tree --> gDS --> lxml ...) now seems to work reasonably well,
  although I'm guessing that there are still bits missing (in
  particular, support for xs:anyAttribute).
1048

1049
Version 2.8c (provisional) (01/30/2013)
1050

1051
1052
1053
1054
- Changed generated check for attributes that are already_processed
  to use a set object rather than a list.  Since sets are hashed, I
  believe that lookup is faster.

dkuhlman's avatar
dkuhlman committed
1055
Version 2.8b (01/30/2013)
1056

dkuhlman's avatar
dkuhlman committed
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
- Fixed missing underscore in reference to member names in
  generateExportLiteralFn_2.  Thanks to Sergii Chernysh for
  reporting this.
- Fixed use of NameTable for mapping names when an element has an
  attribute and a child with the same name.  Needed to use correct
  name (original name or mapped name) when doing (1)
  fix_dup_names, (2) exportAttributes, and (3) buildAttributes.
  Thanks to Mike Vella for reporting this.
- Fixed gds_parse_datetime so that it will handle fractional
  seconds.  Thanks to Matt Hughes for providing this fix.  Now,
  xs:dateTime values that include microseconds are successfully
  parsed and exported.
- Created a Mercurial repository for generateDS at Bitbucket:
  https://bitbucket.org/dkuhlman/generateds
dkuhlman's avatar
dkuhlman committed
1071

dkuhlman's avatar
dkuhlman committed
1072
Version 2.8a (01/10/2013)
1073

dkuhlman's avatar
dkuhlman committed
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
  * Fix to process_includes.py so as to remove the limitation on the
    number of unique names it can generate when raising anonymous
    types to the top level.  Thanks to Daniel Browne for help with
    this.
  * Added support for multiple level attributeGroup, i.e. for
    attribute groups that themselves contain references to other
    attribute groups.  Thanks to Harley Green for pointing out the
    need for this.  Also added a unit test for attribute groups.
  * Added support for more date and time simple types, specifically
    gYear, gYearMonth, gMonth, gMonthDay, and gDay.  Thanks to
    Nicholas Krasney for catching this.  Added tests in the unit
    tests for these types.
  * Quite a bit of code clean-up with the help of the flake8 Python
    code checker.  This is predominantly code cleanup that does not
    affect behavior, most commonly splitting lines that are longer
    than 80 characters across multiple lines for readability.  (See:
    http://pypi.python.org/pypi/flake8 for info about the flake8
    Python code checker.  I use it with the Syntastic plugin for the
    Vim text editor.)
  * Added generation of a dictionary that maps element definition
    names to generated class names.  Thanks to Elena Dolinin for the
    original work on this one.
  * Added support for xs:date and xs:dateTime.  These are now
    captured as instances of class datetime.datetime from the Python
    standard library.  They are parsed and exported with the help of
    that class and using methods gds_format_date,
    gds_format_datetime, gds_parse_date, and gds_parse_datetime in
    class GeneratedsSuper (which is part of the generated module).
    Logan Owen did the work on this.  Thanks much to Logan for
    implementing this and contributing this patch.
  * Turned logging off.  I did not realize that generateDS.py had
    been creating a log file (generateDS.log).  Logging can be
    turned back on by modifying the logging calls near the top of
    generateDS.py.
  * Fixed exception that is thrown when the XML schema file (.xsd)
    only contains a simple type.  Now, the output is generated, but
    it contains no data representation classes.  Thanks to Daniel
    Browne for catching this.

Version 2.7c (08/06/2012)
1114

dkuhlman's avatar
dkuhlman committed
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
  * Added xs:hexBinary to the list of string types in generateDS.py
    and django/generatedssuper.py.  Effectively, we are generating
    the same code for types xs:base64Binary and xs:hexBinary.  That
    leaves it up to the user to add code that converts into and out
    of these formats.  Thanks to Peter Kreinhöfer for finding this.
  * Added support for compressed export, that is, export without
    ignorable white space (indentation and new lines).  Normally the
    generated export methods produce pretty-printed (indented) XML
    output.  With this change, we generate modules which enable you
    to export in a way that omits ignorable whitespace.  It is
    anticipated that this feature will be useful to those who need
    to export XML documents that are machine readable but not human
    readable.  Thanks much to Logan Owen for doing the work on this
    one.  Compressed (non-pretty-print) output is produced by
    passing the keyword argument pretty_print=False to the export
    method.  There is a note in the document (generateDS.html) about
    it; see section titled "Exporting compact XML documents".

Version 2.7b (12/10/2011)
1134

dkuhlman's avatar
dkuhlman committed
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
  * Fix for xs:any in buildChildren in an element defined with no
    other children so that we do not generate "else:" clause without
    an "if ...:".  Thanks to Keith Robertson for help with this.
  * Change for xs:any in buildChildren (when maxOccurs > 1) so that
    the gds_build_any() method always, consistently takes a single
    *child* node as input and returns a single built object.  Thanks
    Marcin Tustin for guidance with this.
  * Fix for element definition containing an anonymous
    xs:simpleType.
  * Added xs:time to list of handled simple (date, time) types.

Version 2.7a (11/04/2011)
1147

dkuhlman's avatar
dkuhlman committed
1148
1149
1150
1151
1152
1153
1154
1155
  * Fix for case where a child is defined with a reference (ref="")
    to a complexType (rather than a simpleType) and the complexType
    is abstract.
  * Added minimal support for xs:any.  See section "Support for
    xs:any" in the documentation.
  * Added unit test for xs:any.

Version 2.6b (10/13/2011)
1156

dkuhlman's avatar
dkuhlman committed
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
  * Fix for case where a child element is declared with a type that
    is a simpleType whose restriction base is another simpleType
    that is referred to with a namespace prefix.  With this fix we
    ignore the prefix, so that at least it will work when there are
    *not* two different simpleTypes whose qualified names have the
    same local name (qualified name minus the namespace prefix).
    Thanks to Thomas Nichols for finding and reporting this one.
  * Added a unit test for the above restriction base with namespace
    prefix.
  * Added a blank character when needed at the beginning and end of
    of doc strings inserted in generated classes to protect against
    the case where the doc string begins or ends with a double quote
    character.
  * Fixes to various files in the tutorial/Code/ directory and to
    the text files in the tutorial/ directory in order to make them
    more consistent and less confusing.  Added the individual sample
    code files to the distribution so that users will not have to
    find and unzip a zipped archive.
  * Fixes to files in tests/ and to the distribution config
    (MANIFEST.in) so that the distributed version would pass unit
    tests.  (Please let me know if it does not.)
  * Removed file generatedssuper.py from the distribution.  Added
    notes to the documentation on how to create this module by
    copying from a generated module for those who want to customize
    those methods in the common superclass.
  * Fix to django/generatedssuper.py -- Regularized and fixed the
    names generated in models and forms files.
1184
  * Fix to the code that generates the ``member_data_item_/MemberSpec_``
dkuhlman's avatar
dkuhlman committed
1185
1186
1187
1188
1189
1190
1191
1192
    list/dict.  If the type of a child element is defined by a
    reference (ref="") to an element rather than, e.g.  a
    complexType, it was using the child's name not it's type.
  * Added xs:base64Binary and xs:language to the list of string
    types in generateDS.py and django/generatedssuper.py.  Also,
    xs:anyURI and xs:duration.

Version 2.6a (07/28/2011)
1193

dkuhlman's avatar
dkuhlman committed
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
  * Fix to capture xs:/xsd:/etc namespace prefix from schema.  Was
    not setting global variable XsdNameSpace.  Thanks to Frank Liauw
    for focusing my attention on this one.
  * Fix for substitutionGroup -- Was not setting the correct
    instance variable during generation of build method when child
    is a member of substitutionGroup.  Thanks to Serge Dikic for
    finding this one and bringing it to my attention.
  * One more attempt to fix whether to call the exportChildren
    method when the complexType is an extension and not a
    restriction and not defined with simple content that extends a
    simpleType.  Thanks to Jaime Cepas for alerting me to this.
  * process_includes.py has a fix to the problem where there are
    more than one anonymous complexType that define elements with
    the same name.  The issue is that generateDS.py must generate a
    Python class for each complexType and cannot do so in this case.
    One solution, which is now implemented in process_includes.py,
    is to raise each complexType to top level in the schema DOM tree
    and to give it a name.  process_includes.py does this by
    appending "Type" to the name, and when there are duplicate
    names, appending "1" or "2" or ... to that.
    So far this change passes my tests, but it does not work for
    you, then comment out the call to raise_anon_complextypes().
    Thanks to Amal Khailtash for finding a schema that exhibits this
    problem and bringing it to my attention.
  * Fix for generation of export method that exports xs:anyAttribute
    when there is an xsi:type attribute.
1220
  * Fix for use of ``valueOf_`` -- Should only be used when element is
dkuhlman's avatar
dkuhlman committed
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
    defined either with (1) mixed content or (2) simpleContent.
  * Question: The xsi:type attribute is being exported for any
    derived type.  Perhaps it's harmless, but it seems excessive.
    When should the export method have that code to export the
    xsi:type attribute?  Only for types derived from (an extension
    of) an *abstract* base type?  Only for the abstract base type
    itself?  Only when a derived type is substituted for a base type
    using the base type's tag and the xsi:type attribute to specify
    the derived type?  Need to investigate.
  * I've reworked the xsi:type attribute stuff.  It now operates on
    the following assumptions: (1) an instance of any complexType
    that has been extended can have an xsi:type attribute (which
    specifies one of the extending types) and (2) the generated code
    should export the xsi:type attribute only and always when (if
    and only if) the element in the input instance document has that
    attribute.
  * A patch to convert floats and ints etc to str during export.
    Thanks Jaime Cepas.
  * Fixes to ctor/initializers when there is a default value for a
    an child element defined as a complexType containing
    simpleContent.
  * librarytemplate -- (1) Renamed documentation files to
    librarytemplate_howto.html and librarytemplate_howto.txt for
    consistency with the name of the librarytemplate distribution
    file (currently librarytemplate-1.0a.zip).  (2) Added the
    documentation and distribution files for librarytemplate to the
    main generateDS distribution file.
  * Added xs:byte to the list of integer types.

Version 2.5a (06/06/2011)
1251

dkuhlman's avatar
dkuhlman committed
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
  * Fix for generation of default value in parameters for the
    constructors.
  * Fix for lookup of attribute value in generated buildAttributes
    methods -- Formerly, attribute names having a namespace prefix
    were not being found.
  * Added some support for xs:group -- Named model groups (model
    group definitions) are now treated as definitions of blocks of
    elements to be copied/inserted where referred to.  This
    replacement has been added to the preprocessing done in
    process_includes.py.  So, this <xs:group ref="some_def"/> is
    replaced by the contents of <xs:group name="some_def"> ...
  * Fix to generation of calls to validator methods for child
    elements.  Before the fix, the validators were called in
    buildAttributes methods but not in buildChildren.  Also,
    generation of the validator method (stubs) was also missing in
    some cases.  Thanks to Béres Botond for alerting me to this.
  * Fixes to generateds_gui.py -- Now it can load a session again.
    Also a fix to the check for and warnings about the changes to
    current session on exit.
  * process_includes.py -- Fix for yet another problem with
    including the same file multiple times when included from
    different directories.

Version 2.4c (03/21/2011)
1276

dkuhlman's avatar
dkuhlman committed
1277
1278
1279
1280
1281
1282
1283
  * Added minimal support for unsignedLong, unsignedInt, and
    unsignedByte.
  * Made the retrieval of the parent (superclass) name and parent
    object for an element more consistent.  Fixed some cases where
    this was not handled correctly, in particular, the generation of
    arguments and paramenters for ctors (__init__) was inconsistent
    and caused errors.
1284
  * Regularized the handling of ``fromsubclass_`` and added this
dkuhlman's avatar
dkuhlman committed
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
    handling to the exportChildren methods.  This is used to tell a
    superclass, during build and export, that the subclass has
    already performed certain operations.
  * Fix to process_includes.py so as to prevent it from loading
    schemas multiple times.  The check for already_processed was
    formerly incorrect.
  * Fix related to restrictions on complexType -- Do not generate
    call buildChildren in the superclass for restrictions (as
    opposed to extensions) of a complexType.  Ditto for
    exportChildren.  Note that restrictions must repeat (and
    restrict the value of) each sub-element that is to be included
    in the content of the restriction.  See:
    http://www.w3.org/TR/2004/REC-xmlschema-0-20041028/#DerivByRestrict

Version 2.4b (02/21/2011)
1300

dkuhlman's avatar
dkuhlman committed
1301
1302
1303
1304
1305
1306
  * Fix to generation the superclass in the class statement header
    line.  Formerly we did not correctly pick-up the superclass
    name (from extension base="").  Thanks to Timo Sugliani for
    finding this bug.

Version 2.4a (02/16/2011)
1307

dkuhlman's avatar
dkuhlman committed
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
  * A few fixes to format of some error messages.
  * Clean-up names in the exportableClassList (__all__).
  * Modify reading session object/doc to use lxml instead of
    minidom.
  * Fix to process_includes.py to protect against crash when an
    import element is missing a schemaLocation attribute.
  * Fix to parsing and exporting simpleTypes declared as lists
    (<xs:list>).
  * Added new methods to class GeneratedsSuper to validate (during
    build) and format (during export) for simpleTypes declared as lists
    (<xs:list>).
  * Fix for incorrect detection of type during generation of build
    method.
  * Added first cut at generating Django models and forms.
    Thanks to Derek Corbett for this suggestion.
  * Added "meta-app" that generates Django database models and
    Django forms.  See doc and files in subdirectory django/.
  * Fix to generation of __all__ list: converted non-word
    characters to "_" etc
  * Fix to process_includes.py so that it uses the entire path to a
    file when trying to determine whether it duplicates a previous
    import.  Perhaps this will avoid skipping an import when
    attempting to import two files with the same name from
    different directories.  Thanks to Mihai Ibanescu for pointing
    out this fix.

Version 2.3b (12/28/2010)
1335

dkuhlman's avatar
dkuhlman committed
1336
1337
1338
1339
1340
1341
1342
1343
  * Fix for simpleTypes defined as a restriction whose (ultimate)
    base type is a pre-defined simple type which were not generating
    correct (type-specific) code in build method.  Thanks to
    Noel Merket for finding this problem.
  * Fix for simpleTypes defined as a xs:list with "itemType"
    attribute where the type was not being recognized.
  * Fix so that we recognize some other simple types as xs:string
    type (e.g. xs:NMTOKEN, xs:ID, xs:Name).
1344
1345
1346
  * To do -- If a simpleType is a restriction on another simpleType and
    the base simpleType definition is declared as a list, we are
    not recognizing that it is a list.
dkuhlman's avatar
dkuhlman committed
1347
1348

Version 2.3a (12/02/2010)
1349

dkuhlman's avatar
dkuhlman committed
1350
1351
1352
1353
1354
1355
1356
1357
  * Added generatation of code to handle attributes inherited by a
    restriction from its base type and the types that the base
    extends (i.e.  from a restriction base class and its
    superclasses).  Thanks for help from Jaime Cepas.
  * Fix to code that generate the references to the superclass from
    a type that is an extension: special characters (e.g. dash)
    were not being cleaned/mapped.  Reported by Koen Smets; thanks.
  * To do:
1358

dkuhlman's avatar
dkuhlman committed
1359
1360
1361
1362
    - In a restriction, inherited attributes can be "prohibited". 
      It would be nice if gDS would do something to block their
      use.
    - When:
1363

dkuhlman's avatar
dkuhlman committed
1364
1365
1366
          AbstractElement mixed=false and
          Element1 mixed=true base=AbstractElement and
          Element2 mixed=FALSE base=AbstractElement 
1367

dkuhlman's avatar
dkuhlman committed
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
      Incorrect parse code is generated for Element2.
      Reported by Jaime Cepas.
    - It might be desirable if the getter functions could be asked
      to return values encoded to utf-8 for xs:string types.
    - Code that is generated to export to python code needs
      updating, in particular we need to update encoding of
      exported strings.  Thanks to Kristoffer Kobosko for
      reporting this.
    - Update to the code that generates code that exports Python
      literals (exportLiteral ...).  In particular: (1) fix
      excoding of Python code and of string literals (unicode, utf-8).

Version 2.2b (11/10/2010)
1381

dkuhlman's avatar
dkuhlman committed
1382
1383
  * Added generation of __all__ global variable containing a list
    of generated class names.  This enables you to do a reasonably
1384
    safe "from mymodule import \*".  It's sorted, so it also gives
dkuhlman's avatar
dkuhlman committed
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
    you something in the way of an alphabetical table of contents
    of the generated classes.  Thanks to Jaime Cepas for this.
  * Added another fix so that the generated code for mixed content
    elements will not generate empty blank lines on export.  Thanks
    again to Jaime for this fix.
  * Added patch to sort mixed content in their class containers.
    Jaime contributed this one too.  Thanks again.
  * Added check for endless recursion while collection list of
    parent type element names.  When detected, raises exception
    that identifies the elements.  Thanks to Maximilian Holtzberg
    for finding this one.  One case that can cause this problem is
    when an element type definition extends a type definition of
    the same name in a different namespace.  Since generateDS.py
    ignores the namespace, this looks like a type that is extending
    itself.
  * Modified code generated to process token lists in order to
    prevent breakage processing some strings.
  * Updated the tutorial so that the examples use the new parsers
    (ElementTree or lxml).
  * The "Clear" buttons in generateds_gui.py is broken when run with
    GTK2.  generateds_gui.py is still usable, but, if you need to
    erase the contents of a text field, you will have to do so
    manually until I can figure out a fix.

Version 2.2a (9/14/2010)
1410

dkuhlman's avatar
dkuhlman committed
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
  * Changes for coding consistency -- Used wrt() pervasively
    instead of outfile.write().
  * Re-write of process_includes.py -- It now handles
    xs:include/xs:import elements that include a file from another
    directory that incude a file relative to that directory that
    include a file across HTTP, and so on.
  * The command line option --search-path is no longer supported.  I
    don't think that behavior was standard for XML schema anyway.
    Removed support for search_path from generateDS.py,
    process_includes.py, and generateds_gui.py.
  * Added support for specifying additional name mappings in a config
    file: generateds_config.py.  That file, if it exists, must be
    located where it can be imported by generateDS.py and should
    contain a dictionary named NameTable.  For example, the following
    maps the name "range" to "rangeType" so that if the schema defines
    a complexType "range", generateDS.py will generate a class named
    "rangeType":
1428

dkuhlman's avatar
dkuhlman committed
1429
1430
1431
        NameTable = {
            'range': 'rangeType',
            }
1432

dkuhlman's avatar
dkuhlman committed
1433
1434
1435
1436
    See the doc for more on this.
  * Instead of using the lower() function from the string module,
    added a function to the GeneratedsSuper class and used the string
    method.  Prepares for Python 3.0
1437
  * Added ``gds_`` prefix to all methods in class GeneratedsSuper to
dkuhlman's avatar
dkuhlman committed
1438
1439
1440
1441
1442
1443
1444
1445
    make possible name clashes less likely.
  * Fixes to exporting elements with mixed="true" -- Reduced extra
    whitespace.
  * Fixes to building (capturing) attribute values for elements with
    anyAttribute="..." -- Eliminated capture of duplicate attribute
    values.
        
Version 2.1d (8/23/2010)
1446

dkuhlman's avatar
dkuhlman committed
1447
1448
1449
1450
  * Fix to indentation of generated code in the build method for
    type checking of NonNegativeIntegerType.
  * Fix to generation parameters in call to superclass constructor. 
    Count of children was incorrect, triggering generation of
1451
    ``valueOf_``.
dkuhlman's avatar
dkuhlman committed
1452
1453
1454
1455
1456
1457
1458
1459
  * Known issue -- If type B extends type A, and type A declares
    anyAttribute, then duplicate attributes with the same name may
    be produced during export.
  * Known issue -- Some namespaces ("{URI}") are not converted to
    namespace prefix during export.  The needed information is not
    available during export.

Version 2.1c (8/8/2010)
1460

dkuhlman's avatar
dkuhlman committed
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
  * Fix to functions parse, parseString, and parseLiteral so that
    they start the build with the correct root class.  I believe
    that there yet is another case that this does not handle,
    specifically when element name is different from class/type
    name and the element definition is not the first definition in
    the schema.
  * Fix to generation of build method for derived elements (i.e.
    elements with "extension base=".  These were being treated as
    if they were abstract, i.e. 'abstract="true"'.
  * Fix to generation of the call to the superclass constructor in
    the generated subclass module.  Prevented the generation of
    duplicate arguments.
  * Added a comment to the generated superclass module at the top
    that specifies the utf-8 source code encoding:
1475

dkuhlman's avatar
dkuhlman committed
1476
1477
1478
        # -*- coding: utf-8 -*- 

Version 2.1b (8/2/2010)
1479

dkuhlman's avatar
dkuhlman committed
1480
1481
1482
1483
1484
1485
1486
1487
  * Fix to generation of export functions.  If no children, must
    generate "pass" statement.
  * Changed generated get_all_text function so that it uses an "if"
    statement instead of a conditional (if) expression.  The
    conditional expression does not work with older versions of
    Python.

Version 2.1a (7/8/2010)
1488

dkuhlman's avatar
dkuhlman committed
1489
1490
1491
1492
1493
  * Added ability to capture annotation/documentation element text
    as doc-strings in the generated classes.  Thanks to
    Roy Williams for suggesting this and for guidance.

Version 2.0b (6/24/2010)
1494

1495
  * Fix to generation of export method so that ``valueOf_`` is exported
dkuhlman's avatar
dkuhlman committed
1496
1497
1498
    when childCount == 0 and not isMixed.

Version 2.0a (6/21/2010)
1499

dkuhlman's avatar
dkuhlman committed
1500
1501
1502
1503
1504
1505
1506
  * Switched to use of lxml/ElementTree in generated files. 
    Thanks to Biswanath Patel and Jaime Huerta Cepas for
    encouraging me to implement the switch to lxml/ElementTree.
  * Modified the generation of functions parse(), parseString(),
    and parseLiteral() so that they automatically recognize the
    root element of an instance XML document and call the build
    method of the appropriate class.
1507
  * Fix to ``hasContent_`` method so that in elements defined
dkuhlman's avatar
dkuhlman committed
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
    with extension-base, the superclass is checked also.
  * For classes that must call an overridden method m in the
    superclass, switched to use "super(superclassname, self).m(...)"
    instead of "m.(self, ...)".
  * Known issues -- (1) generateDS.py loops and crashes with
    "RuntimeError: maximum recursion depth exceeded" on some
    schemas (for example collada_schema_1_4.xsd).  (2) Failure in
    process_includes.py with import of remote file and nested
    imports (for example collada_schema_1_5.xsd).

Version 1.20g (5/21/2010)
1519

dkuhlman's avatar
dkuhlman committed
1520
1521
1522
1523
  * Update to documentation -- Added a section on suggested ways to
    handle/recognize different top level (root) elements.

Version 1.20f (5/3/2010)
1524

dkuhlman's avatar
dkuhlman committed
1525
1526
1527
1528
1529
  * Fix to generation of export so that anyAttribute does not cause
    duplicate attributes to be exported.
  * Fix so that we do a better job of determining whether a
    reference to a type is a simple, builtin type in generation of
    constructor.
1530
1531
  * Fix to generation of constructors so that (1) ``valueOf_`` is
    intialized in subclass modules and (2) ``valueOf_`` is initialized
dkuhlman's avatar
dkuhlman committed
1532
    to None (rather than '').
1533
  * To do: Extend the --root-element flag so that we can specify both
dkuhlman's avatar
dkuhlman committed
1534
1535
1536
1537
    the tag name and the element/type name.  Sometimes they are
    different.

Version 1.20e (2/8/2010)
1538

dkuhlman's avatar
dkuhlman committed
1539
1540
1541
1542
1543
1544
1545
  * Fixed error that caused incorrect tag name to be exported
    when the tag name contains special characters and the tag name is
    different from the type name.
  * Fixed links so that latest versions are included in the install
    distribution file.

Version 1.20d (2/3/2010)
1546

dkuhlman's avatar
dkuhlman committed
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
  * Updated version number/info in genereateds_gui.py.
  * Fix to process_includes.py -- Handle include elements and
    import elements in the same way.  In particular, allow both to
    reference schema files on either the local file system or
    remotely across the Net (via ftp or http).
  * Fix to generation of properties -- When the name of a member is
    mapped (e.g. a Python language keyword), wrong name for getter
    and setter was used.
  * Fix to generation of export methods: missing encoding.
  * Fix to selection of type for exportLiteral.
  * Added missing files in the tests/ directory to the distribution.

Version 1.20c (1/1/2010)
1560

dkuhlman's avatar
dkuhlman committed
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
  * Replaced symbolic links in the distribution with hard links. 
    Symbolic links do not work on MS Windows.
  * Fix to the use of the subprocess module in generateds_gui.py,
    which had caused a problem on MS Windows.
  * Cosmetic fix in generateds_gui.py: labeled "Save" (session) button.
  * Fix so that File/Open action in generateds_gui.py will check
    for and warn user if the session data has been modified.
  * Fix to generation of code for simpleContent with restriction:
    now treats the restriction element as a superclass.  Thanks
    to Franis Sirkovic for catching this and for providing the
    patch.  Also added a unit test for this case.

Version 1.20b (12/14/2009)
1574

dkuhlman's avatar
dkuhlman committed
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
  * Fix to process_includes.py so that it handles relative paths
    in include/import elements in the schema.
  * Various fixes and additions to the GUI front-end, e.g. added
    "Clear" buttons to erase some fields.
  * Fixed bug -- self.inRestrictionType was not initialized.
  * Added --session command line option to generateDS.py -- It
    can now use session files generated by the GUI front-end.
  * Fixes to the generation of the exportLiteral methods.  We can
    now export Python literal representation of an instance doc
    that can be read/imported by Python.
  * Added unit test for generation of Python literal representation.
  * With the help of Erica Tolbert, generateDS.py can now generate
    bindings for gcdml (Genomic Contextual Data Markup Language. 
    See http://gensc.org).  Thank you, Erica.
  * generateDS.py can now generate bindings for the following
    (rather large) schemas:
1591

dkuhlman's avatar
dkuhlman committed
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
    - gcdml -- Genomic Contextual Data Markup Language --
      See http://gensc.org
    - Collada -- 3D Asset Exchange Schema 1.5 -- See
      http://www.khronos.org/collada/
    - Vcloud --Cloud computing -- See
      http://www.vmware.com/solutions/cloud-computing/vcloud.html
    - FpML -- Financial products Markup Language -- See
      http://www.fpml.org/

Version 1.20a (12/01/2009)
1602

dkuhlman's avatar
dkuhlman committed
1603
1604
1605
1606
  * Added first version of the GUI front-end.  See the generateDS
    doc (generateDS.html).

Version 1.19a (10/21/2009)
1607

dkuhlman's avatar
dkuhlman committed
1608
1609
1610
1611
  * Enhancement to the table of information generated in each class
    when the --member-specs=list|dict command line option is used. 
    For a complexType defined as a simpleType, we now generate a
    list of the simpleType and the simpleTypes it is based on using
1612
    name ``valueOf_``.  Thanks to Ryan Leslie for much help and
dkuhlman's avatar
dkuhlman committed
1613
    guidance with these changes.
1614
    Example::
1615

dkuhlman's avatar
dkuhlman committed
1616
1617
        'valueOf_': MemberSpec_('valueOf_', [u'RelationType', 
            u'RelationType2', u'xs:string'], 0),
1618

dkuhlman's avatar
dkuhlman committed
1619
    Note the following incompatible changes:
1620

1621
      - _MemberSpec changed to ``MemberSpec_`` -- We want avoid posible
dkuhlman's avatar
dkuhlman committed
1622
1623
        name conflicts, not make it "weakly hidden".  See the Python
        style guide for more on this
1624
      - _member_data_items changed to ``member_data_items_`` -- Same
dkuhlman's avatar
dkuhlman committed
1625
        reason.
1626
      - Method ``MemberSpec_``.get_data_type() now returns the last item
dkuhlman's avatar
dkuhlman committed
1627
        if the types is a list and the single type if not a list.
1628
      - Method ``MemberSpec_``.get_data_type_chain() is a new method that
dkuhlman's avatar
dkuhlman committed
1629
        returns the entire list of data types.
1630

dkuhlman's avatar
dkuhlman committed
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
    The new tutorial (see tutorial/tutorial.html in the
    distribution) has an example of the use of the MemberSpec
    feature.
  * Fix to DecimalType -- In some cases treated as an integer. 
    Should be a float.  Thanks Ryan Leslie for catching this.
  * Removed last bits of the generation of a SAX parser.  It no
    longer worked and is not needed.
  * Several fixes to determination and handling of types.
  * Added unit test for extensions to simple types and for MemberSpec.
  * There is now a preliminary version of a tutorial.

Version 1.18f (9/14/2009)
1643

dkuhlman's avatar
dkuhlman committed
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
  * Fixes to process_includes.py from Mihai Ibanescu.  These fixes
    address namespace and namespace prefix problems for XML tree
    that is copied into a document.  Thanks Mihai.
  * Added xs:anySimpleType to the list of OtherSimpleTypes.  This
    prevents anySimpleType from being used as a base type.
  * Change so that sub-classes are generated for types that do not
    have children or attributes.
  * Fixed crash that occurred when a simple type is nested in a simple
    type and use of memberTypes attribute.
  * Fix to GeneratedsSuper -- Inherit from "object".
  * Added command line option --no-versions,
    which, when used, tells generateDS.py not to insert the
    version in generated files.  This is useful when you want to
    be able to compare generated files and not detect version
    differences.
  * Patch to eliminate extra space after element tag.  Thank you
    Ryan Leslie.

Version 1.18e (9/1/2009)
1663

dkuhlman's avatar
dkuhlman committed
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
  * Added patch from Mihai Ibanescu which handles and expands
    groups.  Also added Mihai's unit test for groups.  Thank you,
    Mihai.
  * Added patch, also from Mihai, that passes the node's text to
    the super-class constructor.  
  * Added patch that implements a --no-dates command line flag
    which, when used, tells generateDS.py not to insert the
    time-stamp in generated files.  This is useful when you want to
    be able to compare generated files and not detect date/time
    differences.  Thanks again to Mihai.

Version 1.18d (8/26/2009)
1676

dkuhlman's avatar
dkuhlman committed
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
  * Automatic detection of the namespace prefix used in the schema
    document.  Thanks to Mihai Ibanescu for this enhancement.
  * Fix to deal conflicts with generateDS's internal function
    names, for example "build".  Thanks again to Mihai.
  * Upgrade to the unit test harness.  Replace popen (which is
    deprecated) with use of the subprocess module.  Thank you Mahai.
  * Fix in the class constructors (__init__) to cast XML primitive
    types (xs:integer, xs:float, etc) to Python built-in types
    (int, float, etc).  Thanks once more to Mahai.
  * Fix to add enumeration value resolution when the possible
    values are not declared in an explicit definition but in a "top
    level" type.  Also fix a bug with enumeration value population
    for elements where the unwound element stack contains more than
    one element.  Thanks to Chris Allan for this fix.

Version 1.18c (8/11/2009)
1693

dkuhlman's avatar
dkuhlman committed
1694
1695
1696
  * Small changes related to check for mixed content.
  * Enhancement to generation of hasContent_() method to check for items
    with maxOccurs > 1.
1697
  * Fix for generation of test for ``valueOf_`` in hasContent() method.
dkuhlman's avatar
dkuhlman committed
1698
1699
1700
1701
  * Fix for generation of initializers in ctor -- children were being
    skipped when the element is mixed.

Version 1.18b (7/29/2009)
1702

dkuhlman's avatar
dkuhlman committed
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
  * Fix for exception with simpleType that is an extension of 
    another simpleType.
  * Change to mixed extension chain -- Will now generate class.
  * Fix to generation of constructors -- Will now initialize to
    default value for simpleTypes.
  * Fixed generations of validator methods, validator bodies, 
    and call to validator bodies for attributes.
  * Command line option "--validator-bodies" now triggers check for
    option value is an existing directory.
  * Various cleanup, deleting commented-out debug code, etc.
  * Now writing help messages, error messages to stderr instead of
    to stdout.

Version 1.18a (7/14/2009)
1717

dkuhlman's avatar
dkuhlman committed
1718
1719
1720
1721
1722
1723
1724
1725
1726
  * Added command line flag --member-specs to generate the member
    specifications as described in "User Methods" section of the doc.
    The member specs can be a list or a dictionary.
  * Fix to export indentation.  Thanks Tim Marchelli.
  * Added a utility script: generate_coverage.py which generates a
    dictionary of class names and classes from a (superclass) module
    generated by generateDS.py.

Version 1.17d (7/2/2009)
1727

dkuhlman's avatar
dkuhlman committed
1728
1729
1730
1731
1732
1733
1734
1735
  * Fix for generation of recursively defined simpleTypes, e.g.
    a simpleType defined as a restriction of another simpleType.
    (see fix_simpletype comment in generateDS.py)
  * Added version number to generated class files.
  * Fixes to/for process_includes.py -- DirPath/DIRPATH now initialized
    correctly and fixed failure to initialize a local variable.

Version 1.17c (6/24/2009)
1736

dkuhlman's avatar
dkuhlman committed
1737
1738
1739
1740
1741
1742
1743
1744
1745
  * Fix for error generating code for exporting related to
    simpleType.
  * Fix for syntax error in export of boolean types.
  * Fix for export of elements with type of attribute defined
    in-line.
  * Fix to generation of export function when the --silence
    command line option is used.

Version 1.17b (6/10/2009)
1746

dkuhlman's avatar
dkuhlman committed
1747
1748
1749
1750
  * Fix so that generateDS.py will still work with Python 2.4. 
    Thanks to Dave Sugar for that.

Version 1.17a (5/20/2009)
1751

dkuhlman's avatar
dkuhlman committed
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
  * Modified export of children of type xs:string so that
    (1) if None, not exported and (2) if not None but an
    empty string, exported (example "<aa></aa>").
  * Generated calls to format_string(), format_integer(), etc
    in the generated export methods.  Enables the user to
    override these methods to customize format of exported
    values.  See the "Overridable methods" section in the
    doc (generateDS.html) for more info and for an
    explanation of how to override these methods.
    Currently used to give the user control over formatting
    of values during export.
  * Fixes to generated build and export methods so that
    elements defined as xs:simpleType as handled as
    the specificsimpleType xs:restriction base, for example
    xs:string, xs:integer, etc.

Version 1.16e (4/28/2009)
1769

dkuhlman's avatar
dkuhlman committed
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
  * Eliminated generation of SAX parser.  I'm sure it no longer
    worked, anyway.
  * Fix to export of CDATA characters, provided by Kerim Mansour.
    Thanks.
  * Added support for command line option --external-encoding.
    Exported character data is now encoded to sys.getdefaultencoding()
    or to the encoding specified by command line option
    --external-encoding.
  * Added attributes (in addition to children) to the list of
    data type specifications in _MemberSpec/_member_data_items.
    This fix was provided by Ryan.
  * Several fixes suggested by Kerim Mansour including one related
    to export of CDATA.  Thank you Kerim.
  * Removed generation of SAX parser.  It did not work
    any more anyway.

Version 1.16d (3/25/2009)
1787

dkuhlman's avatar
dkuhlman committed
1788
1789
1790
1791
1792
  * Fixes to generation of the exportLiteral functions.  We
    can now do exportLiteral, then import the resulting file 
    in Python.  See generated parseLiteral() for an example.
  * Added an additional parameter to the export() methods.
    Now, you can call export() as follows:
1793

dkuhlman's avatar
dkuhlman committed
1794
1795
        rootObj.export(outfile, 0,
            namespacedef_='xmlns:abc="http://www.abc.com/namespacelo"')
1796

dkuhlman's avatar
dkuhlman committed
1797
1798
    which will insert the namespace prefix definition in the
    exported root element.
1799
1800
  * Added new command line option ``--namespacedef=`` to specify
    the ``namespacedef_`` to be passed in by the generated
dkuhlman's avatar
dkuhlman committed
1801
    parse() and parseString() functions.  Example use:
1802

dkuhlman's avatar
dkuhlman committed
1803
1804
1805
1806
        generateDS.py --namespacedef='xmlns:abc="http://www.abc.com/"'
            -o out.py myschema.xsd

Version 1.16c (3/13/2009)
1807

dkuhlman's avatar
dkuhlman committed
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
  * One more fix for abstract types -- When the implementation
    element/class for an abstract class exports itself, it adds
    the xsi:type="class_name" attribute.
  * A minor fix to handling namespace prefix and the -a command
    line option.
  * Additional fixes so that in constructors (__init__), all
    instance variables are initialized to None.
  * Some fixes to quoting and escaping quotes when exporting
    attribute values.  Thanks to Kerim Mansour for help with this.

Version 1.16b (3/9/2009)
1819

dkuhlman's avatar
dkuhlman committed
1820
1821
1822
1823
  * Added support for restriction/list, i.e. a list of words
    separated by whitespace.

Version 1.16a (2/16/2009)
1824

dkuhlman's avatar
dkuhlman committed
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
  * Generated export methods now check for empty content and 
    write out <xx ... /> rather than <xx ...></xx> if empty.
  * All generated constructors (__init__()) now initialize
    instance variables to None.
  * Generated export methods now check for None before attempting
    to write out attributes and children.
  * More consistent use of direct access to instance variables
    rather than calling getter methods with a class, that is
    use of self.xxx rather than self.get_xxx().

Version 1.15d (1/22/2009)