Polymorphism in xml ??

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sony Antony

    #1

    Polymorphism in xml ??

    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 substitutionGro up 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 substitutiongro up 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
Working...