You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Jason Wood <ja...@auto-trol.com> on 2005/01/04 16:58:43 UTC

[Betwixt] question

New user.

I want to produce the following xml and can't figure out how to accomplish
this using .betwixt files. Any help would be appreciated. I read the getting
started page (http://jakarta.apache.org/commons/betwixt/guide/start.html),
Example 1 is what I want the example to look like. This is what betwixt
generated by default (nice!)...

<?xml version='1.0' ?>
  <item>
    <attributes>
      <MyAttribute>
        <id>0</id>
        <subs>
          <MyIntSub>
            <id>0</id>
          </MyIntSub>
          <MyIntSub>
            <id>0</id>
          </MyIntSub>
          <MyIntSub>
            <id>0</id>
          </MyIntSub>
        </subs>
      </MyAttribute>
    </attributes>
    <id>0</id>
  </item>

but I want to remove the the underlined elements to produce...

<?xml version='1.0' ?>
  <item>
    <MyAttribute>
    <id>0</id>
      <MyIntSub>
        <id>0</id>
      </MyIntSub>
      <MyIntSub>
        <id>0</id>
      </MyIntSub>
      <MyIntSub>
        <id>0</id>
      </MyIntSub>
    </MyAttribute>
    <id>0</id>
  </item>

the betwixt files...

 <<Sub.betwixt>>  <<IntSub.betwixt>>  <<Attribute.betwixt>> 
the java files...

 <<Sub.java>>  <<IntSub.java>>  <<Item.java>>  <<Attribute.java>> 
Thanks
Jason




Re: [Betwixt] question

Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
hi jason

(better late than never)

the default behaviour is for elements within collectives to be wrapped 
by an element. i think you'll get what you want by setting 
setWrapCollectionsInElement property to false on the 
IntrospectionConfiguration of the XMLIntrospector used to introspect 
your beans.

(betwixt uses a variety of configurable, pluggable strategies and 
properties to give control over the way that beans are rendered. if 
something is not obvious in the documentation, then a look at the 
javadocs for IntrospectionConfiguration and BindingConfiguration will 
show the way.)

- robert

On 4 Jan 2005, at 15:58, Jason Wood wrote:

> New user.
>
> I want to produce the following xml and can't figure out how to 
> accomplish
> this using .betwixt files. Any help would be appreciated. I read the 
> getting
> started page 
> (http://jakarta.apache.org/commons/betwixt/guide/start.html),
> Example 1 is what I want the example to look like. This is what betwixt
> generated by default (nice!)...
>
> <?xml version='1.0' ?>
>   <item>
>     <attributes>
>       <MyAttribute>
>         <id>0</id>
>         <subs>
>           <MyIntSub>
>             <id>0</id>
>           </MyIntSub>
>           <MyIntSub>
>             <id>0</id>
>           </MyIntSub>
>           <MyIntSub>
>             <id>0</id>
>           </MyIntSub>
>         </subs>
>       </MyAttribute>
>     </attributes>
>     <id>0</id>
>   </item>
>
> but I want to remove the the underlined elements to produce...
>
> <?xml version='1.0' ?>
>   <item>
>     <MyAttribute>
>     <id>0</id>
>       <MyIntSub>
>         <id>0</id>
>       </MyIntSub>
>       <MyIntSub>
>         <id>0</id>
>       </MyIntSub>
>       <MyIntSub>
>         <id>0</id>
>       </MyIntSub>
>     </MyAttribute>
>     <id>0</id>
>   </item>
>
> the betwixt files...
>
>  <<Sub.betwixt>>  <<IntSub.betwixt>>  <<Attribute.betwixt>>
> the java files...
>
>  <<Sub.java>>  <<IntSub.java>>  <<Item.java>>  <<Attribute.java>>
> Thanks
> Jason
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org