I was wondering if I could get some guidance on how to do the following:

I have a Class like so:

public class Parent {

        private int id;
        private String name;
        private Collection children = new ArrayList();
        
        //setters and getters

}

public class Child {

        private int id;
        private String name;

        //setters and getters
}

I need Castor to marshal to an XML file like so:

<?xml version="1.0" encoding="UTF-8" ?>
<children>
        <child>
                <id>4321</id>
                <name>Child 4321</name>
                <parentId>1234</parentId>
                <parentName>Parent 1234</parentName>
        </child>

        <child> 
         .
         .
         .
        </child>

          .
          .
          .
</children>

So essentially Castor will be given a list of "Parent"s which each contain a 
list of "Child"ren. Instead of having Castor spit out the normal hierarchy, 
where a parent contains a list of child object, I need castor to just iterate 
through all children of each parent and spit out the child attributes with 
their associated parent attributes.

Hopefully I'm making sense (even if the reason why I'd want to do this remains 
a mystery).

Thanks,

Craig.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to