Jason-
It looks like there are some transcription errors between your xml and
your mapping file (for instance defenseDesignDocument in xml vs. just
DesignDocument in the mapping file), but once I fixed those, I got the
same error you did. I fixed it by changing the mapping of the Asset class:
<class name="Asset">
<field name="latitude" type="Latitude">
<bind-xml name="units"
location="properties/location/shape/point/position"/>
</field>
</class>
to:
<class name="Asset">
<field name="latitude" type="Latitude">
<bind-xml name="latitude"
location="properties/location/shape/point/position"/>
</field>
</class>
Castor was looking at the Asset class instead of the Latitude class for
the xml name of the element (this makes sense when to me when I think
about digging down through the xml rather than up from the inner
elements). With that change Castor throws this exception:
Illegal Text data found as child of: latitude
value: "36.2718"{file: [not available]; line: 13; column: 93}
So I changed your mapping for the Latitude class from:
<class name="Latitude">
<field name="units" type="string" >
<bind-xml name="units" node="attribute" />
</field>
<field name="latitude" type="string" >
<bind-xml name="latitude" node="element" />
</field>
</class>
to:
<class name="Latitude">
<field name="units" type="string" >
<bind-xml name="units" node="attribute" />
</field>
<field name="latitude" type="string" >
<bind-xml name="latitude" node="text" />
</field>
</class>
And then everything appeared to unmarshal correctly.
Hope the deadline goes well.
Stephen
Green, Jason M. wrote:
This is my last post for a long time, I promise. :)
Okay, so here's the deal: I have an xml document that I am trying to
unmarshal. The portion I am concerned with is posted here:
<MDADocument>
<defenseDesignDocument>
<defenseDesign>
<properties>
<assetList>
<properties>
<asset>
<properties>
<location type="absolute">
<shape>
<point>
<position>
<*latitude
units="degrees">36.2718</latitude*>
<longitude
units="degrees">44.6302</longitude>
</position>
</point>
</shape>
</location>
</properties>
</asset>
</properties>
</assetList>
</properties>
</Design>
</DesignDocument>
</MDADocument>
The mapping portion I have is this:
<mapping>
<class name="Latitude">
<field name="units" type="string" >
<bind-xml name="units" node="attribute"/>
</field>
<field name="latitude" type="string" >
<bind-xml name="latitude" node="element"
</field>
</class>
<class name="Asset">
<field name="latitude" type="Latitude">
<bind-xml name="units"
location="properties/location/shape/point/position"/>
</field>
</class>
<class name="PlanData">
<map-to xml="MDADocument"/>
<field name="assets" type="Asset" collection="vector">
<bind-xml name="asset"
location="DesignDocument/Design/properties/assetList/properties"/>
</field>
</class>
</mapping>
I'm getting the error: unable to find FieldDescriptor for 'latitude' in
ClassDescriptor of position{file: [not available]; line: 22; column: 75}
Based on the hierarchy and the mapping file, can you all figure out what
is giong on? I've been looking at it for the better part of 2 hours….
By the way, this is my last hurdle and I will done with parsing for
quite a while, so I'm pleading for some quick help
Thanks,
Jason
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------