Re: XML coding questions

From: John Martyniak (jmarty..x.netcom.com)
Date: Thu Dec 02 2004 - 13:48:14 EST

  • Next message: Kevin J. Menard, Jr.: "Re: XML coding questions"

    Kevin,

    I don't remember if I sent this example.

    But here is a real example of generated data from a XML mapping file I
    included the mapping file also.

    As near as I can tell this is the same format as your example.

    Hope that this helps.

    -John

    The Mapping File.
    <model>
        <entity name="com.bds.app.actiontracker.framework.eo.Item"
    xmlTag="Item">
            <property name="statusId" xmlTag="statusId"/>
            <property name="itemIdentifier" xmlTag="itemIdentifier"/>
            <property name="priorityId" xmlTag="PriorityId"/>
            <property name="openedBy.firstName" xmlTag="openedFirstName"/>
            <property name="openedBy" xmlTag="openedBy"/>
            <property name="ownedBy" xmlTag="ownedBy"/>
            <property name="notifications" xmlTag="notifications"/>
            <property name="status.displayName" xmlTag="status"/>
            <property name="priority.displayName" xmlTag="priority"/>
            <property name="component.displayName" xmlTag="component"/>
            <property name="shortDescription" xmlTag="shortDescription"/>
            <property name="dateAdded" xmlTag="dateAdded"/>
            <property name="dateDue" xmlTag="dateDue"/>
            <property name="dateResolved" xmlTag="dateResolved"/>
            <property name="assignTos" xmlTag="assignTos"/>
            <property name="statusText" xmlTag="statusText"/>
            <property name="resolutionText" xmlTag="resolutionText"/>
            <property name="itemId" xmlTag="itemId"/>
            <property name="itemNum" xmlTag="itemNum"/>
            <property name="itemTypeId" xmlTag="itemTypeId"/>
            <property name="itemType.displayName" xmlTag="itemType"/>
            <property name="projectId" xmlTag="projectId"/>
            <property name="project.projectName" xmlTag="project"/>
            <property name="longDescription" xmlTag="longDescription"/>
            <property name="url" xmlTag="url"/>
            <property name="releaseItems" xmlTag="releaseItems"/>
           <!-- <property name="release.releaseName" xmlTag="releaseName"/>
            <property name="release.shortReleaseName"
    xmlTag="shortReleaseName"/> -->
        </entity>
        <entity name="com.bds.app.actiontracker.framework.eo.User"
    xmlTag="openedBy">
            <property name="firstName" xmlTag="firstName"/>
            <property name="lastName" xmlTag="lastName"/>
        </entity>
        <entity name="com.bds.app.actiontracker.framework.eo.ReleaseItems"
    xmlTag="releaseItems">
            <property name="releaseItemsId" xmlTag="releaseItemsId"/>
            <property name="release.releaseName" xmlTag="releaseName"/>
            <property name="release.releaseVersion" xmlTag="releaseVersion"/>
        </entity>
        <entity name="com.bds.app.actiontracker.framework.eo.User"
    xmlTag="ownedBy">
            <property name="firstName" xmlTag="firstName"/>
            <property name="lastName" xmlTag="lastName"/>
        </entity>
        <entity name="com.bds.app.actiontracker.framework.eo.NotifyList"
    xmlTag="notifications">
            <property name="user.firstName" xmlTag="firstName"/>
            <property name="user.lastName" xmlTag="lastName"/>
        </entity>
        <entity name="com.bds.app.actiontracker.framework.eo.AssignTo"
    xmlTag="assignTos">
            <property name="user.firstName" xmlTag="firstName"/>
            <property name="user.lastName" xmlTag="lastName"/>
        </entity>
        <entity name="com.bds.app.actiontracker.framework.eo.TextValue"
    xmlTag="statusText">
            <property name="createdBy.firstName" xmlTag="firstName"/>
            <property name="createdBy.lastName" xmlTag="lastName"/>
            <property name="textValue" xmlTag="description"/>
            <property name="createdOn" xmlTag="createdOn"/>
        </entity>
        <entity name="com.bds.app.actiontracker.framework.eo.TextValue"
    xmlTag="resolutionText">
            <property name="createdBy.firstName" xmlTag="firstName"/>
            <property name="createdBy.lastName" xmlTag="lastName"/>
            <property name="textValue" xmlTag="description"/>
            <property name="createdOn" xmlTag="createdOn"/>
        </entity>

    </model>

    The Generated XML:
    <Item>
        <dateResolved></dateResolved>
        <openedFirstName>John</openedFirstName>
        <itemId>156</itemId>
        <shortDescription>Update entry page to auto populate the Date Added
    field</shortDescription>
        <projectId>4</projectId>
        <itemTypeId>1</itemTypeId>
        <ownedBy>
            <lastName>Martyniak</lastName>
            <firstName>John</firstName>
        </ownedBy>
        <url></url>
        <PriorityId>2</PriorityId>
        <openedBy>
            <lastName>Martyniak</lastName>
            <firstName>John</firstName>
        </openedBy>
        <priority>High</priority>
        <dateDue></dateDue>
        
        <assignTos>
            <firstName>John</firstName>
            <lastName>Martyniak</lastName>
        </assignTos>
        <itemType>Action</itemType>
        <statusId>1</statusId>
        <project>Project Tracker</project>
        <status>New</status>
        <dateAdded>2004-02-27 05:00:00 Etc/GMT</dateAdded>
        <itemNum>0</itemNum>
        <releaseItems>
            <releaseVersion>5.0.1</releaseVersion>
            <releaseName>August Build</releaseName>
            <releaseItemsId>7</releaseItemsId>
        </releaseItems>
        <itemIdentifier>PTRK - ACTN - 156</itemIdentifier>
        
        <component>Database</component>
        <longDescription></longDescription>
        
    </Item>

    On 12/2/04 1:25 PM, "Kevin J. Menard, Jr." <nirvdru..egativetwenty.net>
    wrote:

    >
    > On Dec 2, 2004, at 1:13 PM, Andrus Adamchik wrote:
    >
    >> I agree - any properties shouldbe rooted in the entity that encloses
    >> them
    >> (doesn't matter if this is the main or a dependent entity).
    >
    > Ok. Thanks for the feedback on this guys. This will make my life much
    > simpler :-)
    >
    >> As for the other question about the order of dependent objects
    >> instantiation... there
    >> can be different possibilities. One is to do it in constructor (would
    >> make
    >> sense for an internal HashMap), another one is to create it on demand
    >> before setting the property (e.g. if a dependent is a DataObject)...
    >>
    >
    > The way I'm proceeding then is, if it's a property in the main entity
    > that doesn't reference another entity, assume it's created in the
    > constructor. For those properties that refer to other entities, I have
    > enough information from the other entity block to create the object and
    > then set property afterward.
    >
    >> By the way, I am about to start a project that does a lot of heavy-duty
    >> XML encoding-decoding... So I am really looking forward to using this
    >> feature.
    >
    > I'll try to get a beta out shortly then, so you and John (and others)
    > can give me feedback on it. At this stage, encoding is pretty well
    > set, and decoding with a map file is pretty well set. I need to get
    > decoding without a map file done, and I'm probably going to wrap up
    > exceptions like the WebObjects interface did (so, just some maintenance
    > tasks).



    This archive was generated by hypermail 2.0.0 : Thu Dec 02 2004 - 13:48:51 EST