XML and WebObjects KeyValueCoding

I was just googling to see if someone else had written an EO wrapper for a DOM Document model, and came up with this gem: XML and WebObjects KeyValueCoding by Michael Henderson.

At first blush, this looks like exactly what I need to do. It should be possible to build a pretty solid/transparent/functional DOM wrapper. Probably in a subclass of EOGenericRecord or something like it.

UPDATE: 2004/06/02 - I got it working quite nicely this morning. I query an XStreamDB database, pull all results, read out the full XML of each result, and then feed these into the wrapper class based on Michael's XMLKeyValueCoding class. I use lazy binding, so the parse to Document doesn't happen unless/until it's needed - this should save a lot of time in cases where the results are used in WODisplayGroups etc...

Now, I've been looking into adding an EO interface to the class (or vice versa), and modifying King's XStreamDB EOAdaptor to return these KVC/EO-wrapped objects rather than plain vanilla NSDictionaries. It feels like a much more manageable task than the early "map XML to EO directly" strategy, and I really like that it leaves the XML in a DOM Document, which is as "native" as it can get inside java.

Pulling full IMS LOM XML documents from our XStreamDB database takes roughly 6 ms per record. Tack on another 5 ms per record to wrap and parse, and it's still performing better than the JUD (XML-to-MySQL mapping via PHP and XML-RPC interface), but in a more flexible way.

In my test database, I can run a query that returns 289 results, and the full query, retrieval, wrap and parse process takes just over 3 seconds. That ain't bad, and it's still pretty unoptimized...

See Also

comments powered by Disqus