[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: advocating XML

  • From: "Thomas B. Passin" <tpassin@h...>
  • To: xml-dev@l...
  • Date: Wed, 14 Mar 2001 01:00:00 -0500

xml regex awk
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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.