Also,

There are a couple of problems when I use the generated code to parse an
example XML file...

First thing is unrelated to the type stuff...when generateDS runs it selects
the wrong element type as the root...so when it goes to parse the xml it is
trying to use the wrong element type...this is easy to remedy however, I
just changed it to use the right class's factory() method, though it will
cause the same problem whenever I regenerate it

Second, after I do that it will parse and present the xml back
correctly...except that it is missing the type specific elements. So in the
example I have below, the Policy will have a name and description and then
the AppControlPolicy type will have some Application elements or something.

Since it is parsed as just the base policy type it will only spew out the
name and description and will ignore the application elements. Is there any
way to have it check the xsi:type and parse it using the correct class?

Thanks,

-Brandon

On Wed, May 27, 2009 at 6:14 PM, Dave Kuhlman <dkuhl...@pacbell.net> wrote:

>
> > From: Brandon Pedersen
> >
> > Hi,
> >
> > I am wondering if it is possible to include an xsi:type attribute
> > for an element in the exported xml?  So, right now it exports like:
> >
> > <Policy uuid="....">
> >     ....
> > </Policy>
> >
> > And I would like it to do
> >
> > <Policy uuid="..." xsi:type="AppControlPolicy">
> >     ....
> > </Policy
> >
> > the xsi:type attribute is just the name of the class. I was
> > thinking of just modifying something to add in
> > self.__class__.__name__ but was wondering if there is already some
> > way to tell it to do this.
>
> Brandon -
>
> This sounds like a good idea to me.  In fact, for derived element
> types, it seems like a deficiency if/that code generated by
> generateDS.py does not add the xsi:type attribute in an
> exported instance doc.
>
> I'm looking at http://www.w3.org/TR/xmlschema-0/#UseDerivInInstDocs
>
> Give me a little more time to study it.
>
> - Dave
>
> --
>
> Dave Kuhlman
> http://www.rexx.com/~dkuhlman <http://www.rexx.com/%7Edkuhlman>
>
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to