From: Brandon Pedersen

> 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

Brandon -

Try using the "--root-element" command line option.  Use the "--help"
option to get a bit more info.

> 
> 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.

OK, I'll admit that my understanding of derived types and abstract
types is rather dim.  Now that I've done yet another reading at:

    http://www.w3.org/TR/xmlschema-0/#IPO

it seems like the only difference between an abstract type and a
type from which there is a derived type is that you are not allowed
to have instances of an abstract type.  (You can only have
instances of the types derived from it.)

There is already some support in generateDS.py for abstract types. 
So, I'm going to look into the possibility of using that support
for abstract types for derived types as well.  Wish me luck.

> 
> 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?

I've looking into it just a bit.

Now code generated by generateDS.py is able to export the
xsi:type attribute for derived types.  But, it does not use
that type information when parsing.

Unfortunately I'm going to be traveling for a week.  But, I'll get
on it as soon as I return.

In the meantime, a new version that exports the type info and
has a few other fixes, too, is here:

    http://www.rexx.com/~dkuhlman/generateDS-1.17a.tar.gz

Hope this helps.  And, I'll see about trying to generate code
that pays attention to the xsi:type attribute while parsing
when I return.

- Dave

-- 

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

------------------------------------------------------------------------------
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