RE: WOXMLDecoder
RE: WOXMLDecoder
- Subject: RE: WOXMLDecoder
- From: "Clark, Igor" <email@hidden>
- Date: Mon, 26 Jul 2004 11:15:39 +0100
The XML document should have a root element, which you can use as a
"container" for the collection of transaction records. Use a mapping model
to specify how the XML transactions should be converted into your
transaction objects, and decode the root object as this container. I've
often used this sort of model:
<entity name="com.webobjects.foundation.NSMutableDictionary"
xmlTag="Transaction_List" ignoreUnmappedTags="YES"
contentsKey="transactionList" />
<entity name="JavaTransactionClass" xmlTag="Transaction"
ignoreUnmappedTags="NO">
<property name="attribute" xmlTag="Value" />
</entity>
for XML data files like
<Transaction_List>
<Transaction>
<Value>AABBCC</Value>
</Transaction>
<Transaction>
<Value>AABBCC</Value>
</Transaction>
</Transaction_List>
and used it thus:
WOXMLDecoder decoder; // assume exists
created with mapping model as above
NSMutableDictionary dict =
(NSMutableDictionary)decoder.decodeRootObject(yourXmlFile);
NSMutableArray transactions =
(NSMutableArray)dict.objectForKey("transactionList");
"transactions" now contains your JavaTransactionClass objects.
The way the WOXML[De]Coders work seems a bit arcane sometimes and the
documentation is pitiful but this definitely works for me.
HTH
Igor
-----Original Message-----
From: Baiss Eric Magnusson [mailto:email@hidden]
Sent: 24 July 2004 00:23
To: WebObjectsDev
Subject: WOXMLDecoder
Would anyone disagree with the following?
If you have a XML file that you want to decode into many EO's of the
same type, you can't use WOXMLDecoder, as it is intended for single
object decoding only.
For example, the XML file has 500 transaction records in it.
----
Baiss Eric Magnusson
<http://www.Track-Your-Finances.com>
<http://www.CascadeWebDesign.com>
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.