> From: Mike Vella

>To: Dave Kuhlman <dkuhl...@rexx.com> 
>Sent: Monday, January 28, 2013 9:17 PM
> 


> Dear Dave,
> 
> Thanks for your help, we are using generateDS for the computational
> neuroscience projects libNeuroML
> (http://libneuroml.readthedocs.org/en/latest/) and Pyramidal
> (http://pyramidal.readthedocs.org/en/latest/index.html)
> 
> Your suggestion does almost everything I need . However, I do get an
> error, one of the attribute names I am renaming is from
> "biophysicalProperties" to "biophysical_attributes". Something
> strange is going on because this is causing the generation of the
> following error, I also attach the schema - perhaps with your
> experience of generateDS you can quickly figure out what the issue
> is: 

Mike -

OK. The difficulty is that the complexType Cell is defined with a
child and an attribute that have the same name.  generateDS.py does
handle that situation: it append "_attr" to the attribute name.
And, generateDS.py enables you to map a name to a different name.

However, *until today*, generateDS.py did not handle both of those
cases at the same time.  That was a bug.  I believe I've fixed it
now.

My tests show that it works and successfully adds "_attr" to the
attribute name "biophysical_attributes" (or whatever we map a
name to).

While working on this, I believe I found another, related bug.  I've
fixed that, also.

In a separate email, attached is a patched version of generateDS.py containing 
that fix.

Please let me know if this works for you.

And, thank you for finding this bug and taking the time to report
it.

- Dave

> 
> /home/mike/dev/libNeuroML/neuroml/generateDS/v2mike.py in parse(inFileName)
>    9444     rootObj.export(sys.stdout, 0, name_=rootTag,
>    9445         namespacedef_='',
> -> 9446         pretty_print=True)
>    9447     return rootObj
>    9448 
> 
> /home/mike/dev/libNeuroML/neuroml/generateDS/v2mike.py in export(self, 
> outfile, level, namespace_, name_, namespacedef_, pretty_print)
>    7696         if self.hasContent_():
>    7697             outfile.write('>%s' % (eol_, ))
> -> 7698             self.exportChildren(outfile, level + 1, namespace_, 
> name_, pretty_print=pretty_print)
>    7699             showIndent(outfile, level, pretty_print)
>    7700             outfile.write('</%s%s>%s' % (namespace_, name_, eol_))
> 
> /home/mike/dev/libNeuroML/neuroml/generateDS/v2mike.py in 
> exportChildren(self, outfile, level, namespace_, name_, fromsubclass_, 
> pretty_print)
>    7732             biophysicalProperties_.export(outfile, level, namespace_, 
>name_='biophysicalProperties', pretty_print=pretty_print)
>    7733         for cell_ in self.cells:
> -> 7734             cell_.export(outfile, level, namespace_, name_='cell', 
> pretty_print=pretty_print)
>    7735         for abstractCell_ in self.abstract_cell:
>    7736             abstractCell_.export(outfile, level, namespace_, 
>name_='abstractCell', pretty_print=pretty_print)
> 
>  /home/mike/dev/libNeuroML/neuroml/generateDS/v2mike.py in export(self, 
>outfile, level, namespace_, name_, namespacedef_, pretty_print)
>    8236         if self.hasContent_():
>    8237             outfile.write('>%s' % (eol_, ))
> -> 8238             self.exportChildren(outfile, level + 1, namespace_, 
> name_, pretty_print=pretty_print)
>    8239             showIndent(outfile, level, pretty_print)
>    8240             outfile.write('</%s%s>%s' % (namespace_, name_, eol_))
> 
> /home/mike/dev/libNeuroML/neuroml/generateDS/v2mike.py in 
> exportChildren(self, outfile, level, namespace_, name_, fromsubclass_, 
> pretty_print)
>    8258             self.morphology.export(outfile, level, namespace_, 
>name_='morphology', pretty_print=pretty_print)
>    8259         if self.biophysical_properties is not None:
> -> 8260             self.biophysical_properties.export(outfile, level, 
> namespace_, name_='biophysicalProperties', pretty_print=pretty_print)
>    8261     def hasContent_(self):
>    8262         if (
> 
> 
> 
> On 28 January 2013 22:29, Dave Kuhlman <dkuhl...@rexx.com> wrote:
> Mike -
> 
>  Good to hear from you.
> 
>  Take a look at the section entitled "Conflicts with Python keywords"
>  in the generateDS.py documentation:
> 
> http://www.rexx.com/~dkuhlman/generateDS.html#id16
> 
>  That doc is in your distribution of generateDS.py.
> 
>  Does that do what you need?
> 
>  Hope this helps.
> 
>  - Dave
> 
> 
>  --
> 
> 
>  Dave Kuhlman
> http://www.rexx.com/~dkuhlman
> 
> 
>  >________________________________
>  > From: Mike Vella
>  >To: dkuhl...@rexx.com
>  >Sent: Monday, January 28, 2013 10:36 AM
>  >Subject: generateDS class renaming
> >
>  >
>  >Dear Dave,
>  >
>  >
>  >I'm using generateDS for a project and would like to rename classes 
>produced by generateDS to make the naming more Pythonic. 
>  >
>  >
>  >For instance, If I have an element with the xml tag <coffeeCup_3> I would 
>like to use generateDS to 1. generate classes named CoffeCup3 2. load 
>documents using <coffeeCup_3> into the corresponding (renamed) class and 
>2.when writing back to xml use the tag <coffeeCup_3>.
>  >
>  >
>  >The xml schema I'm working with has a strict naming convention so I can 
>easily use regexp's to switch between the naming conventions - what I'm unsure 
>of is how I can utilise GenerateDS to do what I require.
>  >
>  >
>  >All the best,
>  >Mike
>  >
>  > 
> 
> 1 Attached file
> | 51KB
> NeuroML_v2alpha.xsd
> Download


--


Dave Kuhlman
http://www.rexx.com/~dkuhlman

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to