Jason-
I was able to unmarshal your xml example with a few minor changes to
your mapping file. First, I added a <map-to xml="MDADocument" />
element inside of the <class name="xml.plan.PlanData"> element. This
tells castor when it sees <MDADocument> at the root element, to use the
mapping specified for the class xml.plan.PlanData.
As far as the defenseDesignDocument is concerned, you can use the
location attribute in the bind-xml element to tell Castor that the extra
element exists. The mapping document I had success with is below (note
the change in class names -- you'll need to set it back to fit your
class structure).
<mapping>
<class name="castor.green.one.PlanData">
<map-to xml="MDADocument" />
<field name="documentName" type="string" >
<bind-xml name="documentName" node="element"
location="defenseDesignDocument" />
</field>
<field name="creationDate" type="string" >
<bind-xml name="creationDate" node="element"
location="defenseDesignDocument" />
</field>
<field name="createdBy" type="string" >
<bind-xml name="createdBy" node="element"
location="defenseDesignDocument" />
</field>
<field name="classification" type="string" >
<bind-xml name="classification" node="element"
location="defenseDesignDocument" />
</field>
</class>
</mapping>
HTH,
Stephen
Green, Jason M. wrote:
Hey all,
I have a simple xml document that looks like this:
<MDADocument>
<defenseDesignDocument>
<documentName>JDP Defense Design</documentName>
<creationDate>2005-07-21T11:39:39</creationDate>
<createdBy>JDP</createdBy>
<classification>UNKNOWN</classification>
</defenseDesignDocument>
</MDADocument>
I map it with this xml document:
<mapping>
<class name="xml.plan.PlanData">
<field name="defenseDesignDocument" type="string" >
<bind-xml name="defenseDesignDocument" node="element"/>
</field>
<field name="documentName" type="string" >
<bind-xml name="documentName" node="element"/>
</field>
<field name="creationDate" type="string" >
<bind-xml name="creationDate" node="element"/>
</field>
<field name="createdBy" type="string" >
<bind-xml name="createdBy" node="element"/>
</field>
<field name="classification" type="string" >
<bind-xml name="classification" node="element"/>
</field>
</class>
For some reason it will not unmarshal. I am assuming it is b/c of the
defenseDesignDocument entry in the xml document. I guess the
unmarshaller is looking for a value inside or something. How can I get
by this? I know that I will only have one entry for the
defenseDesignDocument in the xml document so I don't think an extra
class is necessary. Or am I wrong. How would any of you do it?
Thanks,
Jason
Jason Green
Software Engineer
Northrop Grumman MS
[EMAIL PROTECTED]
(540) 469-2407
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------