You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by ji...@gmail.com on 2009/04/13 19:14:57 UTC

[betwixt] Skipping master element

Greetings,

I am trying to compose an object graph which will be output as XML,
using Betwixt. The problem I'm running into is that there is no easy
way to skip the owning element node. Example:

public class Creds { String username; String password; // getters and setters }
public class HostedCreds extends Creds { String hostname; // getters
and setters }

Creds.betwixt
<info primitiveTypes="element">
  <element name="credentials">
    <addDefaults />
  </element>
</info>

HostedCreds.betwixt
<info primitiveTypes="element">
  <element name="hostedCredentials">
    <addDefaults />
  </element>
</info>

output:
<hostedCredentials>
  <credentials>
    <username>foo</username>
    <password>bar</password>
  </credentials>
  <hostname>baz</hostname>
</hostedCredentials>

When I really want to be able to output:
<hostedCredentials>
  <username>foo</username>
  <password>bar</password>
  <hostname>baz</hostname>
</hostedCredentials>

The only way I can see to get this is to manually list all of the
Creds properties in HostedCreds.betwixt. Ugh. My real world problem
has many more properties for many more object graphs, and this is
quite painful. I can't find anything in the documentation, please
help!

Thanks!
-jesse

-- 
There are 10 types of people in this world, those
that can read binary and those that can not.

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