Hi Archie,
The "extends" attribute is mostly just a left-over from the earlier days
of JiBX. The only time it's important is when you're using substitution
groups in your XML documents (which allow you to substitute an extension
element for a base element in a document - such as <vehicle> for the
base element, <automobile> for the extension) - and since substitution
groups are made of elements it makes sense to require a class with a
concrete mapping as the base.
I personally think substitution groups are the best way of handling
polymorphism in XML documents, since the element name tells you the
structure. The alternative of type substitution, where you keep the same
element name and just add an xsi:type attribute to say what you're
really doing, seems kludgy to me.
In terms of the mappings, just using <structure map-as="..."/> gives you
the equivalent of type extension. Though it's not a direct equivalent of
schema type extension, since it allows you to reference the base type
anywhere within the structure of the extension (so really a combination
of schema type extension, group references, and attributeGroup references).
- Dennis
Dennis M. Sosnoski
Java SOA and Web Services Consulting <http://www.sosnoski.com/consult.html>
Axis2/CXF/Metro SOA and Web Services Training
<http://www.sosnoski.com/training.html>
Web Services Jump-Start <http://www.sosnoski.com/jumpstart.html>
On 03/11/2011 07:56 AM, Archie Cobbs wrote:
> I always get confused when trying to use the "extends" attribute...
>
> Here's a simple question: whereas "map-as" allows either a class name
> or a type name, "extends" only allows a class name. Why?
>
> As it stands now, there's no way to extend a mapping that has a type-name.
>
> Thanks,
> -Archie
>
> --
> Archie L. Cobbs
>
>
> ------------------------------------------------------------------------------
> Colocation vs. Managed Hosting
> A question and answer guide to determining the best fit
> for your organization - today and in the future.
> http://p.sf.net/sfu/internap-sfd2d
>
>
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>
------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users