Title: RE: [castor-dev] Xml attribute-element

Thanks.  I tried this out and sure enough, that was the case.  I guess I misunderstood the marshalling.  I thought that if I loaded the mapping for JDO, it automatically would be referenced for marshalling.  I was wrong ;(

Trevor

-----Original Message-----
From: Arnaud Blandin
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: 19/10/01 10:31 PM
Subject: RE: [castor-dev] Xml attribute-element

Hi Trevor,

Are you sure you are plugging correctly your mapping to the
unmarshaller?
To check if you are using the Introspector or the mapping change the
following
property in
castor.properties:
# Defines the NodeType for use with Java primitive types (int, long,
# boolean, etc). This value is only used by the Introspector.
# valid values are either "attribute" or "element". By default
# all primitives are marshalled as attributes. Simply uncomment
# the following line to change the NodeType to element.
#
#org.exolab.castor.xml.introspector.primitive.nodetype=element

If it solved a part of your problem, it means your mapping is not read.

Arnaud

-----Original Message-----
From: Trevor Cook [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 15, 2001 1:08 PM
To: [EMAIL PROTECTED]
Subject: [castor-dev] Xml attribute-element


I'm having problem marshalling, and not sure why.  I know that java
primitives
default to "attribute", but it appears that you can override that
behaviour by
explicitly specifying them (correct?).  I have the following mapping:
  <class name="com.intrinity.instore.castor.UserImpl" identity="id"
key-generator="SEQUENCE">
    <description>User</description>
    <cache-type type="none" />
    <map-to table="users" xml="user" />
    <field name="id" type="integer">
      <sql name="id" type="integer" />
      <xml name="id" node="attribute" />
    </field>
    <field name="name" type="string">
      <sql name="name" type="varchar" dirty="ignore" />
      <xml name="name" node="text" />
    </field>
    <field name="password" type="string">
      <sql name="password" type="varchar" dirty="ignore" />
      <xml name="password" node="element" />
    </field>
    <field name="isGroup" type="boolean">
      <sql name="isgroup" type="bit" dirty="ignore" />
      <xml name="is_group" node="element" />
    </field>
    <field name="isActive" type="boolean">
      <sql name="active" type="bit" dirty="ignore" />
      <xml name="is_active" node="element" />
    </field>
    <field name="createdBy" type="integer">
      <sql name="createdby" type="integer" dirty="ignore" />
      <xml name="created_by" node="element" />
    </field>
    <field name="created" type="date">
      <sql name="created" type="timestamp" dirty="ignore" />
      <xml name="created" node="element" />
    </field>
    <field name="updatedBy" type="integer">
      <sql name="updatedby" type="integer" dirty="ignore" />
      <xml name="updated_by" node="element" />
    </field>
    <field name="updated" type="date">
      <sql name="updated" type="timestamp" dirty="check" />
      <xml name="updated" node="element" />
    </field>
  </class>
and it generates the following xml:
        <user-impl id="8" is-active="true" created-by="2" updated-by="8"
is-group="false">
                <created>2001-09-13T12:01:23.000</created>
                <updated>2001-10-14T12:04:55.000</updated>
                <name>Bob</name>
                <password>bob</password>
        </user-impl>
To be very specific, is-active, created-by, updated-by and is-group
should be
elements (id is correct, I wanted attribu I wanted name to be a te).
Also,text
element inside <user-impl> (I believe it is possible to have text at
same level
as element, correct?).
Thanks to whoever can assist,
Trevor D. Cook

Reply via email to