Hi Dave,

Sorry for the non-obvious formatting of the last e-mail I've sent to you; perhaps you have not noticed the second part of the e-mail.

You've merged the pull request of mine that hopefully solves the mixed content output issues.  I wondered whether generateDS uses any kind of automated testing.   I noticed the 'tests' directory in the repository but it is not straightforward to me how to run all the tests at once.

Best regards,
Eugene

On 15.11.2017 02:42, Dave Kuhlman wrote:
Eugene,

I apologize for being slow.  I've been working on a few other
things.

Looks like you are creating the instances of these classes
programmatically.  So, I'm trying to do the same.  Perhaps that will
help me find out where the problem is.

I'll report back soon, I hope.

Dave

On Thu, Nov 09, 2017 at 06:58:16PM +0300, Eugene Petkevich wrote:
    Hi Dave,

    I apologize for the late answer.  Yes, when using your attached module
    with schema by that simple script:

    import tmp02sup as g
    r = g.rootType.factory(markup=[g.markupType.factory(embedded=['hello'],
nested=[g.nestedType.factory()],
                                                        valueOf_='world')])
    with open('./test.xml', 'w') as f:
        r.export(f, 0)

    And resulting XML is:

    <rootType>
        <markup>
        </markup>
    </rootType>

    So no output was exported within the markup element.  I guess your example
    XML was regarding reading -- yes, reading worked correctly without any
    problems, only exporting back to XML was a problem.

    On 27.10.2017 23:06, Dave Kuhlman wrote:

  Eugene,

  For you information, I've accepted and merged your pull request that
  fixes the export of mixed content elements.  I apologize for being
  so slow.

  Thanks much for this.

  The updated code is at Bitbucket (https://bitbucket.org/dkuhlman/generateds)
  and at the Python Package Index.

  Dave


    I hope my patch solved the issue correctly.  How do you usually test the
    library?  I can try to make some tests (though I'm not experienced much
    within that area, so that could take more time).  Also, I see some code
    which works on Python2 but not Python3, do you think it make sense to make
    the code run in both Python versions?

    Best regards,
    Eugene
    On 30.09.2017 02:06, Dave Kuhlman wrote:

  Eugene,

  With respect to:
  (1)  Export of content with mixed="True".

  I created a simple XML schema and XML instance document.  I
  generated a module from the schema with generateDS.py.  When I run
  the generated module against the XML instance document, I see the
  following output:

      $ python tmp02sup.py test01.xml
      <?xml version="1.0" ?>
      <root>
          <markup>
      This markup has <embedded>content</embedded> withing it.    </markup>
          <markup>
      This markup has
                      <nested>
                  <nested2>Some nested text</nested2>
                  <nested3>1234</nested3>
              </nested>

              withing it.
              </markup>
      </root>

  As you can see, the nested elements are exported.  (We can argue
  about the new lines and white space later.)

  So, there must be some case that my simple example is not covering.
  Most likely I had the same narrow focus and omission when I've
  worked on this in the past.

  Perhaps you can tell me how to modify my example schema so that your
  issue is exposed.

  I've attached my schema and instance document and generated module.
  I'll attach the generated module to a separate message so as not to
  stuff bulk in too many mailboxes.

  By the way, I'm using the following versions (which you can tell by
  looking at the top of the generated module):

      # Generated Fri Sep 29 15:40:19 2017 by generateDS.py version 2.28b.
      # Python 3.5.3 (default, Jan 19 2017, 14:11:04)  [GCC 6.3.0 20170118]

  I'll look into issues (2) and (3) on Monday.  Hope your weekend
  is/was a good one.

  Dave


  On Wed, Sep 27, 2017 at 05:09:24AM +0300, Eugene Petkevich wrote:

  Dear generateDS team,

  I've tried to work on solve several issues regarding XML output by
  generateDS and need some help.  Here are the issues:

  (1)  Export of content with mixed="True".
  I noticed that elements with mixed="True" are not exported at all, both
  their children and text value are missing in XML files.  I've managed to
  change the code that is working, but not sure whether I fully understand
  everything related to mixed element implementation in generateDS.  I've made
  a pull request for that change:
  
https://bitbucket.org/dkuhlman/generateds/pull-requests/26/fix-for-exporting-elements-with-mixed-true/diff

  (2) Namespace prefixes are not preserved when using includes and imports.
  Here I noticed that all export functions for all elements are generated with
  the target namespace of the input schema.  Even if it includes or imports
  another schemas with different target namespaces.  Thus, in the resulting
  XML every element has the same namespace, even if they are supposed to have
  different namespaces. I've tried to check the code and see that includes and
  imports are preprocessed, and original namespaces are not preserved in both
  generateDS code and generated code.  I've tried to implement the fix in
  generateDS, but didn't manage yet.  Maybe you have an advice on how to
  approath the issue?

  (3) When exporting subtyped elemetns, 'xsi:type=...' attribute is not
  exported.
  What is missing in generated code is the only assignment:
  self.extensionType_ = '<type>'
  or calling extensionType='<type>' in constructor of the class.  But again
  I'm not sure where in generateDS should I put that.

  Currently all three issues make it impossible to export a corrent XML (that
  is validated against the corresponding schema);  while it reads XMLs
  correctly, generating corresponding classes, and reading children elements
  and mixed text.

  A temporary solution to the issues was to use a combination of Mix-in
  classes and edits in the generated code.

  Best regards,
  Eugene

  ------------------------------------------------------------------------------
  Check out the vibrant tech community on one of the world's most
  engaging tech sites, Slashdot.org! http://sdm.link/slashdot
  _______________________________________________
  generateds-users mailing list
  generateds-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/generateds-users

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to