[prev in list] [next in list] [prev in thread] [next in thread] 

List:       castor-dev
Subject:    [castor-dev] Container attribute in mapping file, applied on enumerations  eliminates attributes and
From:       "Gerald E. Bennett" <gbennett9 () austin ! rr ! com>
Date:       2003-06-26 7:07:53
[Download RAW message or body]

I started a new thread for my question since I was confused with location.

Well here goes. I created a sample program of my problem:

When using the container="true" on a class.
1) All attribute information is also removed!
   Is it possible to push this to the root element somehow ?
2) If it's used in conjunction with a private variable of type vector that
contains
   entries of the same type of class all sub elements are deleted also. 
   Is there a way to only contain the top level vector itself?

Here is an example output of the included code: when using container="false"
I get:

<TOP name="root">
    <b attribute="attribute1">
        <element>element1</element>
    </b>
    <v>
        <root-a name="sub">
            <b attribute="attribute2">
                <element>element2</element>
            </b>
            <v/>
        </root-a>
    </v>
</TOP>

When using container="true"
I get:
<TOP name="root">
    <b attribute="attribute1">
        <element>element1</element>
    </b>
    <b attribute="attribute2">
        <element>element2</element>
    </b>
</TOP>

Desired is:

<TOP name="root">
    <b attribute="attribute1">
        <element>element1</element>
    </b>
        <root-a name="sub">
            <b attribute="attribute2">
                <element>element2</element>
            </b>
        </root-a>
</TOP>

Note: Also, If I set a container for b the attribute does not get pushed up
to root-a.

Thanks!


> 
> Hi Gerald,
> 
> Your situation is backwards from the location attribute. The location
attribute is used > for adding wrapper elements. You actually want to remove
an element. This is supported > by the notion of "containers".
> 
> You should be able to specify "B" as a container as such:
> 
> <class name="A">
>    <field name="b" type="B" container="true"/>
>    <field name="c" type="C"/>
> </class>
> 
> <class name="B">
>    <field name="b1" type="string">
>       <bind-xml node="attribute"/>
>    </field>
>    <field name="b2" type="string"/>
> </class>
> 
> That should create your desired result.
> 
> --Keith
>   
> 
> "Gerald E. Bennett" wrote:
> 
> Hi Keith,
> I just looked at the bugzilla link you have below and it talks about
> "The location attribute code is actually temporary. It was an initial 
> version, I have some new code I am working on that is more advanced 
> which allows for merging locations, etc"
> 
> You mention "merging locations". Does this mean that you can also
> merge a java attribute of a specific class into an existing element ??
> 
> Here is an example of what I mean:
> 
> Class A
> public B m_b;
> public C m_c;
> 
> public void get B();
> public void get C();
> 
> class B
> int b1;
> String b2;
> 
> class C
> int c1
> String c2;
> 
> I want to create a mapping file to be able to marshall and produce
> following
> xml:
> 
> <a b1="0">
>         <b2>my string</b2>
>         <c c1="0">
>                 <c2> another string</c2>
>         </c>
> </a>
> 	

["CastorContainerTest.zip" (application/x-zip-compressed)]
----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
minimalist@exolab.org with a subject of:
        unsubscribe castor-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic