|
Posted by Keith on July 2, 2007, 12:19 am
Please log in for more thread options
>
>
>
> > On Jun 25, 5:06 pm, 1234mar...@gmail.com wrote:
> >> Can someone tell me if a reliable production PERL package was ever
> >> created to handle either W3C DTD or Schema standards? I realize
> >> libxml2 based packages are very good, but I am not willing to tackle
> >> the maintenance required for compiled libxml2 program in our
> >> production environment.
>
> >> It is the year 2007 for heavens sake; did anyone ever create something
> >> other than poorly tested, partial W3C standards, barely usable module
> >> to handle DTD or Schemas? I have been search CPAN and tested modules
> >> franticly for months without finding anything that is good (other than
> >> lidxml2 stuff looks good).
> > I've said as much before on this group but, .....
>
> > Amongst the many things I've happily & successfully done with Perl &
> > CPAN modules in the last 15 years or so, parsing XML is not one.
>
> I've used both XML::Parser and XML::LibXML successfully (often
> indirectly through XML::Simple). Yes, both rely on a C library to do the
> actual parsing, but I don't see that as a big problem (I need
> other external libraries anyway, especially database stuff, so I
> couldn't run a "pure perl" environment anyway. And from a programmer's
> perspective there is no difference).
>
> > Perl SHOULD be good at this sort of thing (and as others have
> > suggested, the Perl community would love some help on this, I'm sure)
> > but issues w/ recursion and lack of an adequate threading model seem
> > to put it at a disadvantage vis a vis Java, in my opinion, for tasks
> > like this,
>
> I don't think perl has "issues w/ recursion". I've certainly written
> some deeply recursive stuff (so I know about "no warnings 'recursion'").
> Function calls may be slower in perl than in Java, and they are
> certainly a lot slower than in C.
>
> Threading in Perl is broken IMHO. But I don't see what this has to do
> with parsing. That task doesn't seem to be parallelizable to me.
I should have been clearer. One thing is a recursive subroutine,
another
is a recursive Perl script. I've had issues w/ recursive Perl
scripts,
but for parsing XML you're not likely to need these. As for
subroutines...
Because by default everything in Perl is global to the package, this
can create
issues for recursive code. Someone who takes a very disciplined
approach
to writing OO Perl might not have the same issues; but writing
recursive Perl subs usually
requires me to go back and cleanup after myself where I've taken short
cuts to get work
done in a hurry. Of course, languages which don't allow such
shortcuts to begin with
(e.g.: Java), force you to pay this price up front, whether you need
to pay it or not.
Your point is well-taken.
To the point below; again I was not clear. A lot of the work I need
to do in XML involves
parsing a master XML document (SAX - style) with pointers to other XML
documents.
The parallelization here should be obvious: in Java fooParser
instantiates one or
more barParsers, each of which can run in it's own thread. It's
likely that not everyone's
XML needs match that pattern, and might not benefit as much from a
robust threading model.
>
> > while one of Perl's great strengths over Java (built-in regular
> > expression matching) are somewhat wasted on data as structured as XML.
>
> True. XML is designed to be parsed a character at a time. You can do
> that in perl of course, but you have all that overhead of interpreting a
> bytecode which makes things slow. So you want to do that in a language
> which is designed for dealing with data a byte at a time, like C. (Java
> is somewhere in between).
>
> > I've had to write my own lexers & parsers for even the lightest of XML
> > tasks in Perl.
>
> If you wrote your own lexers & parsers in Perl, Perl is obviously good
> enough for you for parsing XML.
>
> hp
>
> --
> _ | Peter J. Holzer | I know I'd be respectful of a pirate
> |_|_) | Sysadmin WSR | with an emu on his shoulder.
> | | | h...@hjp.at |
> __/ |http://www.hjp.at/| -- Sam in "Freefall"
|