Re: Generating XML tree representation of related database data

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu May 12 2005 - 09:26:06 EDT

  • Next message: Erik Hatcher: "Re: Generating XML tree representation of related database data"

    Hi Ilya,

    XML (de)serialization features are on the way for the 1.2 release. Until
    then it should be fairly easy to build a generic DataObject->XML encoder
    based on metadata available in the DataMap:

    1. Create a root node of the (J)DOM tree.

    2. Get a hold of DataObject's ObjEntity.

    3. Iterate through ObjEntity attributes adding them as children to the
    entity root node.

    4. Iterate through relationships repeating steps 2-4 for each one of the
    related entities.

    Note: You can read values for attributes/relationships in a generic
    fashion by calling "DataObject.readProperty".

    Andrus

    > hi,
    >
    > Has anyone tried making a XML document from related data in the
    > database with cayenne? I am stuck with this problem right now - I use
    > cayenne to map and work with a number of related tables and need to
    > extract a certain chunk of related data as a xml document for
    > processing into a pdf. It would be possible to manually construct an xml
    > tree, but I am wondering if there is an easier (more
    > automated)way.
    >
    > Ilya Lazarev



    This archive was generated by hypermail 2.0.0 : Thu May 12 2005 - 09:26:07 EDT