JiBX fails when abstract type is used with flexible="true"
----------------------------------------------------------

                 Key: JIBX-402
                 URL: http://jira.codehaus.org/browse/JIBX-402
             Project: JiBX
          Issue Type: Bug
          Components: core
    Affects Versions: JiBX 1.2.2
            Reporter: Archie Cobbs


Suppose I have these classes:

{noformat}
class Parent {
  public Child getChild();
}

abstract class Child {
  public String getName();
}

class Son extends Child { }

class Daughter extends Child { }
{noformat}

and I want to handle XML that like this:

{noformat}
<parent>
  <son name="fred">
</parent>
{noformat}

or

{noformat}
<parent>
  <daughter name="sally">
</parent>
{noformat}

but I also want to allow and ignore other XML inside the <parent> tag using 
flexible="true".

Even though JiBX can always recognize a "son" or "daughter" tag, it won't 
compile this binding:

{noformat}
<mapping name="parent" class="Parent" ordered="false" flexible="true">
  <structure field="child"/>
</mapping>

<mapping abstract="true" class="Child">
  <value name="name" field="name" style="attribute"/>
</mapping>

<mapping name="son" class="Son" extends="Child">
  <structure map-as="Child"/>
</mapping>

<mapping name="daughter" class="Daughter" extends="Child">
  <structure map-as="Child"/>
</mapping>
{noformat}

You'll get this error:
{quote}Error: All child components must define element names for flexible='true'
{quote}

If you don't use "extends" it works. So basically JiBX has two great features - 
extending abstract mappings and flexible="true", but they don't work together 
even though there is no reason why they can't.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to