• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WOXMLDecoder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOXMLDecoder


  • Subject: Re: WOXMLDecoder
  • From: Baiss Eric Magnusson <email@hidden>
  • Date: Tue, 27 Jul 2004 10:24:20 -0700

Thanks Igor,

That looks good, it does seem to solve the multiple objects problem I had.
I had fixed the model to get rid of the KeyWord as a child of entity Transaction, although eventually I would like to be able to handle my many-to-many relationship between transactions and keys within XML and need to understand the appropriate XML syntax to do such.


But note from the dump of a record:
{values = {transId = <com.webobjects.foundation.NSKeyValueCoding$Null>; loginId = <com.webobjects.foundation.NSKeyValueCoding$Null>;
toWho = "null"; vendor = "Apewx"; isBusiness = "1"; toAccount = "null"; date = 2004-06-15 03:34:39 Etc/GMT; toCategory = "null";
personId = <com.webobjects.foundation.NSKeyValueCoding$Null>; curValue = <com.webobjects.foundation.NSKeyValueCoding$Null>;
expTypeId = <com.webobjects.foundation.NSKeyValueCoding$Null>; toSubCategory = "null"; subCatId = <com.webobjects.foundation.NSKeyValueCoding$Null>;
toExpenseType = "null"; amount = 6.00; transDescr = <com.webobjects.foundation.NSKeyValueCoding$Null>; numShares = <com.webobjects.foundation.NSKeyValueCoding$Null>;
accountId = <com.webobjects.foundation.NSKeyValueCoding$Null>; keyWords = "null"; catId = <com.webobjects.foundation.NSKeyValueCoding$Null>; };
this = "<Transaction a944b0 [Gid Not Found]>"; },


I need something I don't think I can get from <WOXMLDecoder>, which is that the <transaction> record refers to a <category> record, i.e. the XML parsing would have to create in the transaction EO a link to the category record, and create a category record if none was found, the same goes for all the other relationships.

Note: I have 2 reasons for doing this project:
1) I want to be able to set up a demo client and erase and restore the client with different dates, about a 1000 transactions.
2) I want to be prepared for the hoped for eventuality of the banks providing XML of the account transactions, rather than the QIF they now "somewhat" supply.


But here's a partial dump of the resOn Jul 26, 2004, at 3:15 AM, Clark, Igor wrote:

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

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.

----
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.


References: 
 >RE: WOXMLDecoder (From: "Clark, Igor" <email@hidden>)

  • Prev by Date: Re: generate printer friendly page
  • Next by Date: WOForm override "method" attribute
  • Previous by thread: RE: WOXMLDecoder
  • Next by thread: RE: WOXMLDecoder
  • Index(es):
    • Date
    • Thread