There is a new version of generateDS.py -- version 2.9a.

The support for export to lxml/etree seems to be going well.  But,
see note about work needed on xs:anyAttribute, which is my next
task, I suppose.  If you try it, please let me know how it goes.

A few hints for those of you who try the to_etree capability: (1)
Don't forget to add "etree" to the --export command line option (see
help and doc).  (2) You can serialize the etree element tree with
etree.tostring(element).  (3) The lxml function:

    tostring(element, pretty_print= True)

uses 2 spaces per indent level for formatting.  If you need, e.g., 4
spaces per indent level, consider using xmllint with the --format
command line option, e.g.:

    $ xmllint --format="    " input.xml

On GNU/Debian Linux, xmllint can be installed with apt-get.  For MS
Windows, there are binaries.  See:

    http://xmlsoft.org/XSLT/downloads.html
    http://www.zlatkovic.com/libxml.en.html

And, thanks again to Logan Owen for this idea and for doing most of
the work.

Here are a few more notes and details from the README:

# =========================================================

Version 2.9a (02/21/2013)
- 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
  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.
- Added unit test for export to etree.
- 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).

# =========================================================

You can find it here:

- Python Package Index -- http://pypi.python.org/pypi/generateDS/
- Source Forge -- http://sourceforge.net/projects/generateds/

For those of you who prefer using Mercurial, there is also a
Mercurial repository at Bitbucket:
https://bitbucket.org/dkuhlman/generateds

If you have comments, suggestions, or problems, please send them
along.

- Dave



 
--


Dave Kuhlman
http://www.rexx.com/~dkuhlman

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to