XML decoding using a mapping file
XML decoding using a mapping file
- Subject: XML decoding using a mapping file
- From: David Holt <email@hidden>
- Date: Mon, 31 Mar 2008 15:35:08 -0700
I am attempting to decode the following return from a website and I am OH SO CLOSE :-) This is the xml: <?xml version="1.0"?><SearchResult> <Count>2</Count> <IdList> <Id>18326189</Id> <Id>18061844</Id> </IdList></SearchResult>
I am trying to get the list of IDs, but I can only get it as far as the array "IdList". In my HTML component, I am using two WOStrings to display the contents for testing and I get:
Count: 2 Idlist: ({Id = ("18326189", "18061844"); })
Where/how can I specify that ID should just be an integer? I can't change the XML, that is fixed. The IdList tag is confounding my attempts to get an array of ID's because ID ends up being an array of integers the way I've mapped the XML.
The XML model file looks like this:
<model>
<entity name="ca.cscw.SearchResult" xmlTag="SearchResult" ignoreUnmappedTags="YES"> <property name="count" xmlTag="Count" /> <property name="idlist" xmlTag="IdList" forceList="Yes"/> </entity>
</model>
My class for the result is: package ca.cscw;
import com.webobjects.foundation.NSArray;
public class SearchResult {
private String count; private NSArray idlist;
public SearchResult() { }
public String count() { return count; }
public void setCount(String count) { this.count = count; }
public NSArray idlist() { return idlist; }
public void setIdlist(NSArray idlist) { this.idlist = idlist; } }
Thanks for reading this far!
David
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden