Thanks a lot for your quick answer Dave, 
I indeed figured that out, i was hoping for another quicker way (i'm lazy or as 
you guessed short on ressources ;) ). Anyway that answers my question, i'll 
have to determine if i have the time to do it like that.

Thanks again and keep up the good work

Regards


-----Message d'origine-----
De : Dave Kuhlman [mailto:dkuhl...@rexx.com] 
Envoyé : vendredi 26 août 2011 05:21
À : Carre, Olivier; generateds-users@lists.sourceforge.net
Objet : Re: generating instances

>From: "Carre, Olivier"
>Sent: Thursday, August 25, 2011 1:16 AM

>
> Hello Dave,
> 
> I've been playing with generateDS lately, and it is a great tool, i
> must first thank you for it. However i now need to generate xml
> documents from scratch. I mean i have the schemas, i generate the
> bindings and i want to generate an xml file from that. Can it be
> done with generateDS without too much overhead ?
>

Oliver -

Good to hear from you.

Yes, you can generate XML documents using the code generated by
generateDS.py, in fact that is one of the goals or purposes for the
project.  There is some work involved.  You can think of
generateDS.py as generating Python class definitions for each of the
element types in your schema.  (You've already figured that out, I
suppose.)  So, you need to write some code that creates instances of
those generated classes, and hooks them together with the correct
nesting.  Then call the export() function on the top-level
instance/class to generate an instance document.

Imagine a schema that defines an outerType element type contain
instances of an innerType element type.  Then you might do something
like the following:

        inner = innerType()
        outer = outerType()
        outer.set_inner(inner)
        outer.export(sys.stdout, 0)

or:

        outer = outerType(inner=innerType())
        outer.set_inner(inner)
        outer.export(sys.stdout, 0)

Of course, in a real world case, it will be quite a bit more
complex, but that should give you the idea.  Pardon me if I'm
telling you things that you've already figured out.

Hope this helps.  And when you have more questions, let me know.

- Dave



-- 


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






This message contains information that may be privileged or confidential and is 
the property of the Capgemini Group. It is 
intended only for the person to whom it is addressed. If you are not the 
intended recipient, you are not authorized to 
read, print, retain, copy, disseminate, distribute, or use this message or any 
part thereof. If you receive this message 
in error, please notify the sender immediately and delete all copies of this 
message.


------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to