Re: XML coding questions

From: wojingo (wojing..astmail.com.au)
Date: Thu Dec 02 2004 - 03:36:48 EST

  • Next message: Andrus Adamchik: "Re: XML coding questions"

    On Thu, 2004-12-02 at 08:59, Kevin J. Menard, Jr. wrote:
    > Hi,
    >
    > As some of you know, I'm working on an implementation of the
    > WOXMLCoder/Decoder system for Cayenne. Work has been progressing
    > along fairly well as I have time. I am running into a bit of a
    > logical issue with regards to the model file though that I'm hoping
    > someone more familiar with the system might be able to answer.
    >
    > The first entity block is for the object being encoded, and each
    > subsequent one for helper objects. Are the property items specified
    > in these subsequent entities referring to the base object or the
    > helper one?
    >
    > E.g., in the mapping file below:
    >
    > <model>
    > <entity name="Test" xmlTag="Test">
    > <property name="name" xmlTag="statusId"/>
    > <property name="address" xmlTag="itemIdentifier"/>
    > <property name="phone" xmlTag="PriorityId"/>
    > <property name="map.key" xmlTag="embedded"/>
    > <property name="user" xmlTag="ownedBy"/>
    > </entity>
    > <entity name="User" xmlTag="ownedBy">
    > <property name="user.name" xmlTag="ownerName"/>
    > <property name="user.password" xmlTag="clearance"/>
    > </entity>
    > </model>
    >

    I havent used WOXMLCoder/Decoder for ages, but I think it should look
    like the following,

     <model>
          <entity name="Test" xmlTag="Test">
              <property name="name" xmlTag="statusId"/>
              <property name="address" xmlTag="itemIdentifier"/>
              <property name="phone" xmlTag="PriorityId"/>
              <property name="map.key" xmlTag="embedded"/>
              <property name="user" xmlTag="ownedBy"/>
          </entity>
          <entity name="User" xmlTag="ownedBy">
                          <property name="name" xmlTag="ownerName"/>
                          <property name="password" xmlTag="clearance"/>
          </entity>
     </model>

    this would encode to,

    <Test>
    <ownedBy>
      <ownerName>kevin</ownerName>
      <clearance>secret</clearance>
    </ownedBy>
    </Test>

    That would make sense to me... but then again some may say I'm not very
    sensible. :)

    >
    > "user", a property of the Test object, is of type User, which has
    > properties "name" and "password". Should the second entity be using
    > properties "name" and "password" that reference a User object that
    > links to the "user" property in the first entity block, or should they
    > be written as they are, referencing the nested "user.name" and
    > "user.password" properties of the Test object?
    >
    > And is it assumed that all properties are initialized in the
    > constructor? E.g., with "map.key" above, which is a HashMap, if it is
    > only valid after a "set" operation, I have to watch out for null
    > values. If it can be assumed to be initialized, then it's not a
    > problem.
    >
    > Thanks,
    > Kevin

    cheers,

    -- 
    shaun
    



    This archive was generated by hypermail 2.0.0 : Thu Dec 02 2004 - 02:32:34 EST