Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Polymorphism in xml ??

Thread Tools

Polymorphism in xml ??

Sony Antony
Posts: n/a
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.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic polymorphism vs. Static polymorphism Krivenok Dmitry C++ 13 06-01-2006 09:49 AM
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
Polymorphism in GridView (ASP.Net 2.0) Kevin Lawrence ASP .Net 0 02-16-2006 11:32 AM
Polymorphism in xml ?? Sony Antony XML 0 08-26-2003 03:37 PM
XML Polymorphism through inheritance? Ian Mayo XML 4 07-30-2003 02:46 PM