OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: advocating XML



Paul T wrote - (I've removed most of it as it was long)

>
> No, it was not. It was worse, and I'd try to explain why.
>
> Now if you map the A.xml into *regex*line*oriented* file, I bet
> you be surprised how *trivial* the overall task becomes if doing
> it in python or perl or any other scripting language that inherits
> from UNIX.
>
> Not only you'd write this set of converters faster ( because you
> be using a general-purpose language *which xslt is not* ), but
> what you produce will be *correct* , easy to *debug* and *really*
> error-prone.
>

Well, I've also done the regex route, both with python and awk.  In fact, in
this job, I got the form data into the database using python, no xslt or xml
involved.  And I've generated enough html programmatically to know that I'd
rather use templates than functions.  If I have a straight line-oriented job
I'll probably look at awk first, then python.  So I do know what you're
talking about here.

In fact, I'd bet that a lot of the people on this list have used their own
private text formats which they turn into xml using a script and some RE or
string processing.

> Anyone who votes XSLT for programming language should take
> into account that xslt  *silently*  *ignores* almost any mistyping
> you have in Xpath expression. And there is no possible guard
> ( because building the guard kills the XSLT itself ;-)
>
> With regular expressions and accurate design of the 'line'
> you *do*  have a guard !

I find regular expressions at least as difficult and error prone as xslt
expressions.  I suppose it's a matter of practice and how your mind works.
Either way, I have to do a LOT of testing.  I usually find it's easier to
break a tricky RE than an xslt statement, but your mileage may vary,  as
always.
>
> Will do just * fine* for Python or perl. You'd have less code to process
> this stuff comparing even to amount of code you need to use the SAX
machinery
> and when somebody says that :
>
> 'there are better layers upon SAX' in Python,
> I'd say  : "No. It is too complex. All you need is 3 lines of regexprs - get
real".

Depends on the job.  In this case, I'd need several scripts that play
together, and output some format, like HTML.  I could easily have done it with
straight scripts.  I tell you what, though.  For a quick one-time thing, I'd
probably use a script and be done with it.  But when I expect to do something
over and over with variations, I find I want templates and program/document
generators.  I look back at some jobs where I created a bunch of html by
scripting, and wish I had done them with templates instead.  If you are using
xml, then xslt is a natural to use for templates, although you could of course
use something else.

And some things are still done better with scripts.  In the job I mentioned, I
used a mix.

So I actually agree with most of what you said, but I still come out with a
different conclusion.  Well, go figure!  Thanks for your thoughts.

Cheers,

Tom P