Stephen, Sorry about the errors when sending. Did you notice that there were two fields: latitude and longitude? <latitude units="degrees">36.2718</latitude> <longitude units="degrees">44.6302</longitude>
Will having them in separate classes allow me to save the values off properly or is there another way I need to go about unmarshalling them? I forgot to ask that in the last post so I apologize, Jason -----Original Message----- From: Stephen Bash [mailto:[EMAIL PROTECTED] Sent: Thursday, July 28, 2005 2:28 PM To: [email protected] Subject: Re: [castor-user] Mapping document to odd fields in xml doc 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] ------------------------------------------------- ------------------------------------------------- If you wish to unsubscribe from this list, please send an empty message to the following address: [EMAIL PROTECTED] -------------------------------------------------

