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
--
Dave Kuhlman
http://www.davekuhlman.org
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSpy v2007 rel. 3 (http://www.altova.com) by Erwin de Kock
(Philips Electronics Nederland BV) -->
<!--
Tests for mixed="True"
-->
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:element name="root" type="rootType"/>
<xs:complexType name="rootType">
<xs:complexContent>
<xs:element name="markup" type="markupType"
maxOccurs="unbounded"/>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="markupType" mixed="true">
<xs:sequence>
<xs:element name="embedded" type="xs:string"
minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="nested" type="nestedType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="nestedType">
<xs:complexContent>
<xs:element name="nested1" type="nested1Type"
maxOccurs="unbounded"/>
<xs:element name="nested2" type="xs:string"
maxOccurs="unbounded"/>
<xs:element name="nested3" type="xs:integer"
maxOccurs="unbounded"/>
</xs:complexContent>
</xs:complexType>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<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>
------------------------------------------------------------------------------
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