commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tyju tiui <jckdnk...@yahoo.com>
Subject Betwixt Mapping
Date Thu, 27 Sep 2007 05:12:20 GMT
Hi,

I have a nested object which I'm having some trouble with.
The object structure looks like:

Post
----Session
--------Group
------------Field

Each Post object contains an array of Session objects.
Each Session object contains an array of Group objects.
Each Group object contains an array of Field objects.
Pretty straightforward, nothing fancy ...

The xml I get looks like:

<?xml version="1.0" ?>
<post>
    <sessions>
            <session sessionId="0">
                <groups>
                    <group groupName="employee">
                        <fields>
                            <field fieldName="fname" fieldValue="abc"/>
                            <field fieldName="lname" fieldValue=def"/>
                            <field fieldName="id" fieldValue="1222223"/>
                        </fields>
                    </group>
                </groups>
            </session>
            <session sessionId="1">
                <groups>
                    <group groupName="manager">
                        <fields>
                            <field fieldName="fname" fieldValue="ghi"/>
                            <field fieldName="lname" fieldValue="jkl"/>
                            <field fieldName="id" fieldValue="123456789"/>
                            <field fieldName="notes" fieldValue="a note"/>
                        </fields>
                    </group>
                </groups>
        </session>
    </sessions>
</post>

This is almost perfect. I just don't need / want the classname elements (<sessions>,<groups>,<fields>).
My ideal output would look like:

<?xml version="1.0" ?>
<post>
    <session sessionId="0">
        <group groupName="employee">
            <field fieldName="fname" fieldValue="abc"/>
            <field fieldName="lname" fieldValue="def"/>
            <field fieldName="id" fieldValue="1222223"/>
        </group>
    </session>
    <session sessionId="1">
        <group groupName="manager">
            <field fieldName="fname" fieldValue="ghi"/>
            <field fieldName="lname" fieldValue="jkl"/>
            <field fieldName="id" fieldValue="123456789"/>
            <field fieldName="notes" fieldValue="a note"/>
        </group>
    </session>
</post>

My Post.betwixt file looks like this:

<?xml version='1.0' encoding='UTF-8' ?>
<info primitiveTypes='attribute'>
    <element name='post'>
        <addDefaults/>
    </element>
</info>

Any suggestions would be greatly appreciated.

Thanks,

Ty



       
____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get
online.
http://smallbusiness.yahoo.com/webhosting 
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message