> From: Daniel Browne
>Sent: Friday, October 26, 2012 8:12 AM
>

Daniel -

So, let's try to clear some things up.

First, I've worked your change into process_includes.py.  I did a
little re-working, partially because *my* original code was so
inefficient.  Now, with this change, there is no limit to the number
of elements that can be raised to top-level.

Second, about the elements that are not being generated.  Or rather,
that are being generated but with the name of the type, rather than
the name of the element.  (as you describe below) I believe that is
what we actually want.  But, I'll have to investigate a bit further.

Here is what I mean -- Take a look at the header for the export
method, in this case:

class GetUserReq(GeneratedsSuper):
o
o
o
def export(self, outfile, level, namespace_='',
                name_='GetUserReq', namespacedef_='', pretty_print=True):

Notice the parameter name_ with the default value.  If you call
that export method and pass in "name_='getUser', then I believe
that it will generate what you want.

So, you might try calling export with something like this:

rootObj.export(sys.stdout, 0, name_='getUser',
            namespacedef_='',
            pretty_print=True)

Does that make sense?

The reason I say that I'll have to dig a little deeper is that,
while I believe this will work at the top level, I'm not sure that
generateDS.py is smart enough to automatically pass in
"name_='getUser'" when that element is a child element of some other
element.  When I figure that out, I'll let you know.

Thanks, by the way, for your work investigating this, and for your
last email.  That helped me understand what the problem is.  At
least I *believe* I understand.

What do you think?

- Dave


> My initial patch for generateDS does not seem to be sufficient. :(
> 
> My problem is that elements like the one below are not having classes 
> generated for them. 
> The classes I need would have the content of the type while having the name 
> of the "instance" element.
> 
> Example:
> 
> The XSD:
> 
> <xsd:element name="getUser" type="axlapi:GetUserReq"/>
> 
> <xsd:complexType name="GetUserReq">
> <xsd:sequence>
> <xsd:choice>
> <xsd:element nillable="false" name="userid" minOccurs="1" type="xsd:string" 
> maxOccurs="1"/>
> <xsd:element name="uuid" type="axlapi:XUUID"/>
> </xsd:choice>
> <xsd:element name="returnedTags" type="axlapi:RUser" minOccurs="0"/>
> </xsd:sequence>
> <xsd:attribute use="optional" name="sequence" type="xsd:unsignedLong"/>
> </xsd:complexType>
> 
> 
> I need a class to generate XML that looks like this:
> 
>       <ns:getUser>
>          <userid>7001991</userid> 
>       </ns:getUser>
> 
> But the class generated is for GetUserReq, not getUser. It generates XML like 
> this:
> 
> <axlapi:GetUserReq>
>     <axlapi:userid>7001991</axlapi:userid>
> </axlapi:GetUserReq>
> 
> Firstly the outer tags are wrong and secondly having the namespace on the 
> inner tags doesn't seem to work.
> 
> Do you have any way around this?
> 
> 
> 
> 
>  



--


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

------------------------------------------------------------------------------
The Windows 8 Center - In partnership with Sourceforge
Your idea - your app - 30 days.
Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to