Polymorphism in xml ??

S

Sony Antony

We have an xml/java/W3C schema/jaxb based application.
I would like to define some elements that are extensible. In
particular the schema has an element defined as 'exception'. This has
an integer field 'errorcode' and 'reason'. But I would like to allow
the XML to send additional fields, if the particular exception
demands it ( 'status' for ex. )
Is there any way to do this without violating the schema.
If there is what will happen when I unmarshal using jaxb. ( since the
generated classes does not know about these extra fields )

I read about substitutionGroup s in xml. But it does not allow you to
add an additional field. Also it requires the substituting/derived
element to have the same type as the original.

All the examples I saw for substitutiongroup were with a single field
of type xs:string. Is it possible to use this for an element
containing multiple elements. Is there an example for this out there.
Thanks in advance.
--sony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top