Polymorphism in xml ??

Discussion in 'Java' started by Sony Antony, Aug 26, 2003.

  1. Sony Antony

    Sony Antony Guest

    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
     
    Sony Antony, Aug 26, 2003
    #1
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bomb Diggy
    Replies:
    0
    Views:
    594
    Bomb Diggy
    Jul 28, 2004
  2. Ian Mayo
    Replies:
    4
    Views:
    2,885
    Ian Mayo
    Jul 30, 2003
  3. Sony Antony

    Polymorphism in xml ??

    Sony Antony, Aug 26, 2003, in forum: XML
    Replies:
    0
    Views:
    1,136
    Sony Antony
    Aug 26, 2003
  4. Tony Prichard
    Replies:
    0
    Views:
    992
    Tony Prichard
    Dec 12, 2003
  5. Mark Van Orman

    embedding xml in xml as non-xml :)

    Mark Van Orman, Sep 14, 2004, in forum: XML
    Replies:
    5
    Views:
    706
    Patrick TJ McPhee
    Sep 15, 2004
  6. Andy
    Replies:
    0
    Views:
    697
  7. Krivenok Dmitry
    Replies:
    13
    Views:
    1,713
    Axter
    Jun 1, 2006
  8. Erik Wasser
    Replies:
    5
    Views:
    816
    Peter J. Holzer
    Mar 5, 2006
Loading...