James Gray
5/19/2008 7:34:00 PM
On May 19, 2008, at 2:21 PM, Ryan Davis wrote:
> On May 19, 2008, at 05:02 , James Gray wrote:
>
>> Interesting. Can you talk a little about why you prefer using
>> regexen to a parser in this instance?
>>
>> I'm not trying to question your decision. I'm just curious about
>> your reasoning here.
>
> 1) damn fast.
> 2) the xml from apple's plist format is so regular that a generic
> xml parser is way overkill.
> 3) more readable
> 4) damn fast.
Yeah, I think those are great points.
I would add that XPath is practically useless on a plist file.
I'm not sure many people would allow the readable argument for a regex
approach, but I dig it. At a recent local conference, I called out a
two character regular expression from my place in the audience, to
help a presenter verify what he wanted. 30 programmers then proceeded
to debate my expression for the next few minutes. It was sad.
Obviously, if you can't count on the content, the parser is probably
the right choice. But if you can, why not cheat. I like it.
James Edward Gray II