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

Re: XML too hard for programmers?


pull parser perl
Simon St.Laurent wrote:
> This isn't a new thread - sorry - but this time the claim comes from an
> unusual source, that infamous XML-critic Tim Bray:
> 
> http://tbray.org/ongoing/When/200x/2003/03/16/XML-Prog
> 
> "XML is a bouncing thriving five-year-old now, and yet I've been feeling
> unsatisfied with it, particularly in recent times. In particular in my
> capacity as a programmer...."
> 
> It's a page or two of reading, most of which reminds me that markup and
> programming are two different universes which both happen to involve
> computers.  Definitely worth reading.

Hmmm. A couple years after you think you and your friends have convinced all the 
Perl community to not use regex based parsers on XML you get Tim Bray to hit you 
on the back of the head with one. I guess it's fair though, because he makes sense.

In fact, there has been some work within the Perl community to address the 
problems that programmers evidently face when using the dominant 
SAX/DOM/XPath/XSLT combo. Parts of it may be interesting to this conversation, 
notably stuff done by Barrie Slaymaker. You may wish to take a look at EventPath 
as described and implemented here:

http://search.cpan.org/author/RBS/XML-Filter-Dispatcher-0.47/lib/XML/Filter/Dispatcher.pm
http://search.cpan.org/author/RBS/XML-Filter-Dispatcher-0.47/

It is basically a collection of utilities wrapped inside rules that match an XML 
stream using an XPath-like language (which is probably preferable to raw 
regexen, and has in fact similar functionality). They will do things such as 
maintain state for you or assist you doing so, in a way that is much simpler 
than SAX. You need to learn a new little language, but if you know XPath it's a 
five minute job. I don't think the docs do it full justice. He is also rumoured 
to have a pull parser with a nifty interface (a pull parser being close in idea 
to Tim's while loop), but I don't know if it's true or not.

As for adding syntax to Perl 6 it shouldn't be necessary. Built-in regexen is a 
bit weak so Perl 6 is going with built-in grammars, with rules that look a lot 
like methods and will likely support things like parameters and currying, and 
that will provide access to local parse trees. For ideas in that area, you may 
want to poke around:

   design document: http://www.perl.com/pub/a/2002/06/04/apo5.html
   for humans: http://www.perl.com/pub/a/2002/08/22/exegesis5.html

-- 
Robin Berjon <robin.berjon@e...>
Research Engineer, Expway        http://expway.fr/
7FC0 6F5F D864 EFB8 08CE  8E74 58E6 D5DB 4889 2488


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.