Hi,

Here are some other patches. The .xsd shows the problem both patches
try to solve.

First patch (p3.py) tries to deal with conflicts with generateDS's
internal function names. In my case, I had an XML node named 'build'.
Probably all function names should me mapped (export, exportLiteral
etc). The second hunk of the patch makes sure the proper mapped name
gets called in case of a list.

Second patch (p4.py) tries to address a rather pathological case (see
example3.xsd). The same XML node, "build", is defined in different
contexts, once as a complex type, once as a reference. The code does
not look in ElementDict for the proper data, so you will end up with a
mangled XML. Also note that I changed the test from if mappedName in
ElementDict: to elif origName in ElementDict: ; this was because
ElementDict does not store cleaned up names, but the original ones;
with p3 applied, the code was trying to find a definition for build_,
which did not exist in ElementDict.

Finally, p5.patch tries to fix the testsuite: popen* are deprecated in
python 2.6; the order of the tests is not guaranteed, so it's better
to generate the files in a setUp method.

I am not positive these didn't break something else, but they allowed
me to do a successful round-trip test on one of my shemas (generate
.py code out of the schema, feed the python code some xml code that
was validated by the schema, export and make sure the resulting XML is
canonically the same).

Please let me know if this breaks something, I'd really like to see
these in the upstream release (and not have to maintain the patches
myself).

Mihai

Attachment: p3.patch
Description: Binary data

Attachment: p4.patch
Description: Binary data

Attachment: example3.xsd
Description: Binary data

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="http://example.com/schema2"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="schema2.xsd">
  <build name="foo"/>
  <sublevel>
    <build ref="foo"/>
    <build ref="bar"/>
  </sublevel>
</root>

Attachment: p5.patch
Description: Binary data

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to