Inheritance in XML Schema definition (XSD) for Java objects

Posted by bguiz on Stack Overflow See other posts from Stack Overflow or by bguiz
Published on 2010-04-16T07:07:33Z Indexed on 2010/04/16 7:13 UTC
Read the original article Hit count: 236

Filed under:
|
|
|
|

Hi,

I need to create an XML schema definition (XSD) that describes Java objects.

I was wondering how to do this when the objects in question inherit from a common base class with a type parameter.

public abstract class Rule<T> { ... }

public abstract class TimeRule extends Rule<XTime> { ... }

public abstract class LocationRule extends Rule<Location> { ... }

public abstract class IntRule extends Rule<Integer> { ... }

....

(where XTime and Location are custom classes define elsewhere)

How would I go about constructing an XSD that such that I can have XML nodes that represent each of the subclasses of Rule<T> - without the XSD for each of them repeating their common contents?

Thank you!

© Stack Overflow or respective owner

Related posts about java

Related posts about Xml