Hi Dave,
I can understand that reasoning. In my case I validate the XML before
giving it to another component which doesn't have access to the original
XSD, and thus doesn't know the default values.
If it's not too much trouble that command line option would be ideal.
In my use case I only have defaults set for elements (and don't foresee
this changing), so I don't have a preference. Whatever you think is best
for the codebase and is convenient for you :)
Thanks,
Marc
On 19 February 2018 at 23:08, Dave Kuhlman <dkuhl...@davekuhlman.org> wrote:
> Marc,
>
> The thinking is that if the current value and the default value are
> the same, we do not need to write our that attribute, since when
> read back in, the attribute will be given that value anyway.
>
> Apparently, for your use case, this thinking is not correct.
>
> If that's true, I can add a command line option so that attributes
> with values equal to the default value will be exported. But, you
> want to know that if we did this and you use that option, *all*
> attributes with the current value equals their default value will be
> exported.
>
> Is that what you need and want?
>
> Let me know. Adding that new command line option should be
> reasonably easy to do.
>
> Or, do you need this control on an element by element and attribute
> by attribute basis? That would be more messy.
>
> And, by the way, I'm happy to hear that generateDS.py has been
> useful.
>
> Dave
>
> On Fri, Feb 16, 2018 at 03:31:53PM +0000, Marc Capavanni via
> generateds-users wrote:
> > Hi there,
> >
> > Thanks for the great library, it's really useful.
> >
> > I use the library to create a Python API class to generate XMLs based off
> > XSDs.
> >
> > I have a XSD which has the following line.
> >
> > <xs:element default="0.95" name="volume" type="ct:volumeType"/>
> >
> > However when I generated my XML, this element is missing.
> >
> > When looking at the generated code I see this.
> >
> > if self.volume != 0.95:
> > showIndent(outfile, level, pretty_print)
> > outfile.write('<%volume>%s</%volume>%s' % (namespace_,
> > self.gds_format_double(self.volume, input_name='volume'), namespace_,
> eol_))
> >
> > Is this possible?
> >
> > Thanks in advance,
> > Marc
>
> > ------------------------------------------------------------
> ------------------
> > 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
>
------------------------------------------------------------------------------
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