Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Re: Re (tilly) 2: Why is Perl so bad with XML?

by mirod (Canon)
on Jan 31, 2002 at 19:08 UTC ( #142485=note: print w/replies, xml ) Need Help??


in reply to Re: Re (tilly) 2: Why is Perl so bad with XML?
in thread Why is Perl so bad with XML?

Hey, hey, calm down everybody!

I do agree that the attitude of the XML community and of the Perl community are really different, to the point of being antagonistic, as proven by the 2 posts above. The Perl way is "whatever works is fine", convenience tends to be valued above completeness and formalism. The XML way is nearly the opposite: one-format fits all, forcing "the right way" unto unsuspecting coders (Unicode isa perfect example, it annoys 99% of people to no end while just slightly improving the condition of the last 1%), elaborate all-encompassing constructs (W3C Schemas).

Plus of course XML is verbose, and monsters like XSLT and W3C schemas are way worse, while Perl favors economy of strokes and conciseness as a way to get elegance and maintenability. At least you could do SGML golf!

I might be wrong, of course no one has any figure about module usage, but I believe the people who write Perl modules "the XML way", like Matt, Robin Berjon, Ilya Sterin etc... are in a way off-target. In a word they look a bit like XML nationals lost in a foreign Perl country (not that Perl people look terribly good when we go out and attend XML conferences, believe me! I tend to get laughed at when I describe XML::Twig to Real XML Gurus ;--). The modules they write are not what the Perl community wants. Not that their work has no value, I think it is really important for Perl to be used in other context and to spread past its current niche, but it might be something to think about when we try to understand why some very nice modules don't seem to be used much. In any case there is a reason why the current crowd of Perl hackers loves XML::Simple and refuses to use XML::SAX::PurePerl. Java drones want SAX, Perl hackers want XML::Simple (and don't get me wrong, I would be the first to say that I don't think XML::Simple is a generic XML tool, but it is darn convenient!).

I know that XML is annoying as it oftens bring no improvement over home-brewed formats. It is usually imposed by management in order to be buzzword compliant, but for Perl hackers it brings very little to the table, except an additional risk. But let's face it, we will all have to deal with it. XML is a bastard, verbose and actually quite tricky, format that's being used not because it is the best one for any particular purpose but because it is a standard, which allows Java projects to re-use standard SUN or IBM libraries where Perl hackers would use a CPAN module or 2 lines of custom code.

That said I see a couple of reasons why Perl hackers would want to use XML: first as a data format it is actually quite powerful. It makes it easy to stick HTML inside data, it makes it easy to mark data within HTML text. It makes it possible to change the structure of the data without upgrading the code right away (I guess that would be between "loosely coupled systems"), really, you should try it ;--)

  • Comment on Re: Re: Re (tilly) 2: Why is Perl so bad with XML?

Replies are listed 'Best First'.
Re: Re: Re: Re (tilly) 2: Why is Perl so bad with XML?
by Matts (Deacon) on Feb 01, 2002 at 12:34 UTC
    I might be wrong, of course no one has any figure about module usage, but I believe the people who write Perl modules "the XML way", like Matt, Robin Berjon, Ilya Sterin etc... are in a way off-target. ... The modules they write are not what the Perl community wants.

    I have to disagree with you there. Kobesearch.cpan.org keeps some stats, and it shows that beyond the base XML::Parser, XML::DOM is the most popular, followed by libxml-perl (containing the PerlSAX1 code). Granted XML::SAX or other modules like it aren't on the map yet, but the above two modules show that Perl XML users do want standards based tools.

    But I do love XML::Simple - it hits the 80/20 sweet spot most of the time. However I'm much happier now I can use it via SAX not just with XML::Parser, because sometimes (e.g. with mod_perl, or when you can't compile XS), XML::Parser isn't the right tool for the job.

    Maybe you've missed the point about XML::SAX::PurePerl though. Nobody should be using XML::SAX::PurePerl directly (except perhaps SAX module writers test suites). It's simply there as a backup - to try and be a lowest common denominator. That's all. Plus it stops people complaining about there being no pure perl XML parsers ;-)

      I have to disagree with you there. Kobesearch.cpan.org keeps some stats, and it shows that beyond the base XML::Parser, XML::DOM is the most popular, followed by libxml-perl (containing the PerlSAX1 code). Granted XML::SAX or other modules like it aren't on the map yet, but the above two modules show that Perl XML users do want standards based tools.

      Actually I find those statistics quite sad! XML::DOM, in fact the DOM itself, at least level 1, is a really bad tool for most XML transformations, and I would think that libxml is queried just because of the name. Most questions I read are about straight XML::Parser or XML::Simple.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://142485]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2018-11-13 16:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (156 votes). Check out past polls.

    Notices?