Eugene,

Hello.  I'm glad generateDS.py has been helpful.  Thanks for letting
me know.

Here are a few comments:

1. The file gends_user_methods.py is in the source distribution.
   You can find that here:
   https://dkuhl...@bitbucket.org/dkuhlman/generateds

   The documentation is wrong on that.  I'll fix it.

2. With respect to on-file-per-xsd -- In the test directory
   (generateds/tests/ again in the source distribution) there is a
   test that uses that option.  Perhaps you can look at that for
   clues.  The files of interest are:

       generateds/tests/oneper00.xsd
       generateds/tests/oneper02.xsd
       generateds/tests/oneper01.xsd
       generateds/tests/oneper03.xsd

   The unit test when run, generates output modules in subdirectory
   tests/OnePer.

   The command used to run that test is in tests/test.py in method
   test_022_one_per.  Here is that command:

        def test_022_one_per(self):
            cmdTempl = (
                'python generateDS.py --no-dates --no-versions '
                '--silence --member-specs=list -f '
                '--one-file-per-xsd 
--output-directory="tests/Ot_022_one_perePer" '
                '--module-suffix="One" '
                '--super=%s2_sup '
                'tests/%s00.xsd'
            )
            t_ = 'oneper'
            cmd = cmdTempl % (t_, t_, )
            o
            o
            o

   More specifically, about the maxLoops message, that error means
   that you have an element definition that extends another element
   definition, but generateDS.py thinks it should not generate the
   class for the extension because it has not yet generated the
   class for the base/parent.  I've had to work on this once before.
   But, I don't know why that error is happening in your case.

   Do you have a schema that produces this error and that you could
   send me.  If you do, I take a look.

3. With respect to the namespace definition behavior and the
   repeated namespace definitions -- I'll take a look to see how
   this can be done.

6. About parsing from a file-like object -- Actually, if I
   understand you correctly, this already works.  You can pass a
   file object that is open for reading to the generated parse
   functions.  The parameter name is misleading, I suppose.  But,
   lxml.etree.parse does accept either a string file name or a file
   object.

More tomorrow when I have a bit more time.

Thanks for the detailed report.

Dave


On Mon, May 01, 2017 at 11:18:00AM +0300, Eugene Petkevich wrote:
> Hello,
> 
> Thank you for the GenerateDS library.  I find it very useful.  I have a
> couple of things to ask:
> 
> 1) The webpage with example python code, mentioned in the documentation --
> http://www.davekuhlman.org/gends_user_methods.py -- does not exist.
> 
> 2) When I try to use --one-file-per-xsd argument, I get the following error:
> *** maxLoops exceeded.  Something is wrong with --one-file-per-xsd.
> 
> 3) Namespace definition behavior -- by default, generateDS puts namespace
> definition in every export method of generated classes. That is, every
> element in an exported xml that has children would have namespace
> definition.  But what if I only want namespace definition in top-level
> element?  For example, I want this:
> 
> <ns1:topLevel xmlns:ns1="http://somenamespace.org";>
>   <ns1:secondLevel>
>     <ns1:thirdLevel>
>   </ns1:secondLevel>
> </ns1:topLevel>
> 
> Instead of this:
> 
> <ns1:topLevel xmlns:ns1="http://somenamespace.org";>
>   <ns1:secondLevel xmlns:ns1="http://somenamespace.org";>
>     <ns1:thirdLevel xmlns:ns1="http://somenamespace.org";>
>   </ns1:secondLevel>
> </ns1:topLevel>
> 
> I know I can modify export methods and put namespacedef_='' in each of them
> except for the top-level.  But is there any other way to optimize that?  Do
> you think it makes sense to add such feature via a command-line option?  I
> looked into code and it changed to this by modifying just one like, but
> didn't test it thoroughly.
> 
> 4) Several namespaces do not work.
> 
> When there are several namespaces, only one is filled everywhere in
> generated classes.  Therefore it builds the following xml
> 
> <ns1:topLevel xmlns:ns1="http://somenamespace.org";
> xmlns:ns2="http://someothernamespace.org";>
>   <ns1:secondLevel>
>     <ns1:thirdLevel>
>   </ns1:secondLevel>
> </ns1:topLevel>
> 
> Instead of what it should be:
> 
> <ns1:topLevel xmlns:ns1="http://somenamespace.org";
> xmlns:ns2="http://someothernamespace.org";>
>   <ns2:secondLevel>
>     <ns1:thirdLevel>
>   </ns2:secondLevel>
> </ns1:topLevel>
> 
> 5) XML schema extension elements.
> 
> I'm not sure how it should be used, but it seems that extension does not
> work correctly.  In types which are not leaves (that do are not
> extended/subclassed) I see the /extensiontype_ /field, though it is not
> initialized with a name of the subclass, and in leaves it is absent overall.
> Or should it be the desired behaviour? It seems logical to assign type name
> to the /extensiontype_/, then it produces correct xml, at least in my case.
> 
> 6) A nice feature would be if we can parse xml from file-like object, not
> only filename (just like it is exported to the file-like object). Do you
> think the feature is worth adding?
> 
> In case it makes sense to work on these things, I'll be glad to contribute.
> 
> Best regards,
> Eugene
> 


-- 

Dave Kuhlman
http://www.davekuhlman.org

------------------------------------------------------------------------------
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