Re: extract string
Sam wrote:
Rolf Magnus writes:
Sam wrote:
You need a nutcracker. It's a tool designed for the job,
And so it's ALWAYS the right tool?
A nutcracker is always the right tool when the task is to crack nuts.
Even for someone who lives in the
outback, hundreds of miles from the next store without a car - and
without a nutcracker?
Just because one isn't available, it doesn't make a nutcracker any less or
more appropriate for the job.
Well, you can always turn around an "analogy" to fit your argument. Example:
The equivalent to "cracking the nut" here would be "finding the text
between <rfid> and </rfid>". For that, the nutcracker, i.e. simple text
processing is enough. I don't need an electric nutcracking machine that can
also peel fruits and boil coffee.
What would you do in this situation? Go buy one or just use a
stone?
much like an XML parser is a tool designed for the job of parsing XML
content.
However, we're not talking about nucrackers, but rather XML parsers.
That's my point.
If one was, for some reason, foisted with accomplishing this task on some
oddball platform for which no XML parser wasn't available, then perhaps
brute-forcing it might be justified.
But, however, XML parsers are aplenty on most platforms. You always have
them handy, they're always there, so if you need to parse some XML, that's
the right tool to use.
Or if the only thing you want is to find the part of the file that is between
<rfid> and </rfid> without adding a dependany on another library, without
adding full-fledged XML parsing for such a simple task and without having to
write more code just for interfacing with the XML parser.