[
Lists Home |
Date Index |
Thread Index
]
> Bill de hÓra Wrote:
> >And I don't understand this disdain for regular expressions over
> >XML. Regexes are a perfectly useful tool for manipulating text.
>
> Certainly "If all you have is a hammer everything looks like a nail."
> applies here. (No distain, I own more than one hammer)
>
> Yes, XML can be serialized into a string. That feature makes it portable.
>
> But to manipulate it as a string makes it impossible to take advantage of
> properties the XML had to begin with.
>
> There are two worlds. The world of the "value space" and that of the
> "lexical space". If you use a lexical space tool you run the risk of making
> a new lexical representation for which there is NO value space equivalent.
>
> In other words, could you make an error with a regEx tool and end up with
> invalid XML? Yes easily, and probably often.
>
> If you use tools that manipulate in the "value space", then obtain the
> lexical representation that risk goes away.
Bingo. Thus my 'impedance mismatch" and "error prone" comments. Believe me,
in my travels I've seen a lot of ersatz XML processing. I've always been able
to convince clients to chuck it, usuallya fter I demonstrate that there are
ways to process XML just as easily as they think their hacks allow. So my
incredulous reaction was not because I haven't heard this claim of "regex
first", but because it seems amazing to me that this would come from Tim.
|