XML and Perl 138
XML and Perl | |
author | Mark Riehl, Ilya Sterin |
pages | 378 |
publisher | New Rider |
rating | 8 |
reviewer | Davorg |
ISBN | 0735712891 |
summary | Good introduction to processing XML with Perl |
XML and Perl is written by two well-known members of the Perl XML community. Both are frequent contributors to the "perl-xml" mailing list, so there's certainly no doubt that they know what they are talking about. Which is always a good thing in a technical book.
The book is made up of five sections. The first section has a couple of chapters which introduce you to the concepts covered in the book. Chapter one introduces you separately to XML and Perl and then chapter two takes a first look at how you can use Perl to process XML. This chapter finishes with two example programs for parsing simple XML documents.
Section two goes into a lot more detail about parsing XML documents with Perl. Chapter three looks at event-driven parsing using XML::Parser and XML::Parser::PerlSAX to demonstrate to build example programs before going to talk in some detail about XML::SAX which is currently the state of the art in event-driven XML parsing in Perl. It also looks at XML::Xerces which is a Perl interface to the Apache Software Foundation's Xerces parser. Chapter four covers tree based XML parsing and presents examples using XML::Simple, XML::Twig, XML::DOM and XML::LibXML. In both of these chapters the pros and cons of each of the modules are discussed in detail so that you can easily decide which solution to use in any given situation.
Section three covers generating XML documents. In chapter five we look at generating XML from text sources using simple print statements and also the modules XML::Writer and XML::Handler::YAWriter. Chapter six looks at taking data from a database and turning that into XML using modules like XML::Generator::DBI and XML::DBMS. Chapter seven looks at miscellaneous other input formats and contains examples using XML::SAXDriver::CSV and XML::SAXDriver::Excel.
Section four covers more advanced topics. Chapter eight is about XML transformations and filtering. This chapter covers using XSLT to transform XML documents. It covers the modules XML::LibXSLT, XML::Sabletron and XML::XPath.
Chapter nine goes into detail about Matt Sergeant's AxKit, the Apache XML Kit which allows you to create a website in XML and automatically deliver it to your visitors in the correct format.
Chapter ten rounds off the book with a look at using Perl to create web services. It looks at the two most common modules for creating web services in Perl - XML::RPC and SOAP::Lite.
Finally, section five contains the appendices which provide more background on the introductions to XML and Perl from chapter one.
There was one small point that I found a little annoying when reading the book: Each example was accompanied with a sample of the XML documents to be processed together with both a DTD and an XML Schema definition for the document. This seemed to me to be overkill. Did we really need both DTDs and XML Schemas for every example. I would have found it less distracting if one (or even both) of these had been moved to an appendix.
That small complaint aside, I found it a useful and interesting book. It will be very useful to Perl programmers (like myself) who will increasingly be expected to process (and provide) data in XML formats.
You can purchase XML and Perl from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Nice (Score:2)
Would be nice to have a book with more than just one chapter on web services. There are a plethura of Java/C# web services books out there, but it's hard to find one on there just for Perl, PHP, etc.
Re:Nice (Score:5, Informative)
Would be nice to have a book with more than just one chapter on web services.
You might be interested in Programming Web Services with Perl [oreilly.com] then.
I'd buy it ... (Score:1, Funny)
Re:I'd buy it ... (Score:1)
XML has a regular, structured format. It is easily parsed, but almost no one parses it directly. They use a model which represents the data, usually some form of DOM or SAX. Libraries are present in most languages. The need to rely heavily on regular expressions isn't there, and it allows people to choose other languages without paying a huge development penalty.
Not that there isn't a development penalty, but the penalty is mostly same as developing under that language normally. Developing in C will generally take more time than in, say, Perl, Tcl, or Python, because of low-level issues that the other languages don't have. The resulting code, though, isn't necessarily uglier or different in structure.
There are lots of pages on Perl and XML (check google if you don't believe me), but it just seems that Perl doesn't have the overwhelming advantage on other languages on this subject. That's not to say it isn't useful. But if I were to do XML processing, I probably wouldn't be using Perl.
Unless it was to process nasty, arbitrarily formated text into XML.
If you really want your Perl script to be write only, use "chmod 0333 myScript.perl". Nifty language that is constantly coaxing you to the dark side, begging you to give in to your inner desires, to write code that will rip the sanity from those who look at it!
Re:I'd buy it ... (Score:1)
I've never even looked at Python code, but I hear it has a few
Re:You lost me on the incredible leap of logic... (Score:4, Insightful)
"One of Perl's great strengths is in processing text files."
Perl is good at handling text files. XML is a text file. Therefore, Perl is good at handling XML.
As opposed to:
My pasta maker is good at making pasta. Pasta is a type of food. Ice-cream is also food. Therefore, my pasta maker is good at making ice-cream.
Does that help?
Re:You lost me on the incredible leap of logic... (Score:1)
Re:You lost me on the incredible leap of logic... (Score:1)
Consider the following:
for all elements e of a set x, y(e).
z belongs to x.
therefore, by definition, y(z).
Note the "by definition" part.
Re:You lost me on the incredible leap of logic... (Score:1)
y(z) does not follow "by definition" unless your first assumption is the definition of y. It is not the definition of perl that it is good at processing text files. It is at most a fact about perl.
In fact I don't think it makes sense to claim "For all text files T, perl is good at processing T." That's pretty nonsensical if you ask me. And I don't think it's even true that "For all operations O on text files, perl is a good implementation language for O." If this were really true, then it would follow that perl is a good language for any operation that assumes its input is an XML file, which is what the original poster seemed to mean.
What's more reasonable is to relax the statement to "There exists a fairly large class C of operations on text files such that perl is a good implementation language for any operation O in C." But it does not follow from this that perl is good for XML, unless the intersection of C and "XML operations" is a fairly large portion of the latter set.
CJV
Re:You lost me on the incredible leap of logic... (Score:2)
Re:You lost me on the incredible leap of logic... (Score:1)
CJV
Re:You lost me on the incredible leap of logic... (Score:1)
Re:You lost me on the incredible leap of logic... (Score:2)
Re:You lost me on the incredible leap of logic... (Score:4, Insightful)
His:
1. (from earlier in his post) Perl is well suited for processing all text formats.
2. XML is a text format.
3. Therefore, Perl is well suited for processing XML.
Yours:
1. Your pasta maker is good at making pasta.
2. Pasta is a type of food.
3. Therefore, your pasta maker is good at making all types of food (for example, ice cream).
You can see that he went from general to specific, whereas you went from specific to general. He argues that being able to do all things in a given set (process all text formats) gives the ability to do one of the things in that set (process a particular text format). You argue that being able to do one thing in a set (make a particular food) gives the ability to do all things in the set (make all foods).
You could save your argument by changing your middle point to be "All foods are a type of pasta," and then your conclusion becomes trivially true. But you'd also have to get everyone to agree that ice cream is pasta.
Re:You lost me on the incredible leap of logic... (Score:1)
Re:You lost me on the incredible leap of logic... (Score:3, Insightful)
Since my pasta maker is good at making pasta, and ice cream and pasta are both foods, it follows my pasta maker will be just as good at making ice cream.
That only correlates if ice cream is a type of pasta, because XML is a text format.
This is a lot more like saying "since my pasta maker is good at making Ziti, Rigate, Macaroni, etc., all pastas really, and Spaghetti is a type of pasta, my pasta maker should be good at making Spaghetti.
XML is NOT just text! (Score:5, Insightful)
Re:XML is NOT just text! (Score:3, Interesting)
True and then not so. Perl's flexible data structures and OO make it a simpler approach than languages that think XML == Object Serialisation. It is also very likely that a lot of what you're going to see flying by in SAX or hanging around in DOM will be text. Sometimes lots of it, sometimes text that has non-XML structure and requires microparsing.
But anyway, what really puts Perl ahead of the pack (together with Python, the only viable competitor I've tried -- Java is really lagging these days) is its large wealth of SAX (and to a lesser degree, DOM) tools. All sorts of very useful filters can be grabbed, complex pipeline management is a given, the SAX writing framework is cool, there are SAX parsers for many non-XML formats, etc.
Re:XML is NOT just text! (Score:1)
I know that paper, so? I never said it was faster (especially as SOAP::Lite does not use the fastest parsers). I was talking about the flexibility and the wealth of tools. That's easily verifiable, and given that I use both Perl and Java for XML work all day, I simply know I'm right.
Re:XML is NOT just text! (Score:4, Insightful)
Sure smells like text to me.
Re:XML is NOT just text! (Score:3, Insightful)
So, no, XML is not editable in emacs (or vi), grep-able, diff-able or understandable to the naked eye. Go and think about it again.
Re:XML is NOT just text! (Score:3, Insightful)
Re:XML is NOT just text! (Score:2)
'jfb
Re:XML is NOT just text! (Score:2)
You can't efficiently use a text editor to edit pictures, sounds or movies but this doesn't limit our ability to edit them using more appropriate tools.
If I were going to edit or process XML, I would use the best tool for the job and if that's not a text editor, so what?
Re:XML is NOT just text! (Score:2)
> argument for XML
Sure it is. It's the entire justification for having a text-based protocol -- otherwise, why waste the cycles?
'jfb
Re:XML is NOT just text! (Score:2)
>having a text-based protocol -- otherwise, why
>waste the cycles?
You don't use the text-based *representation* unless you are marshalling or unmarshalling the data. When you work with bound XML objects, you are using the document model as a container for methods to process the data, but not necessarily as a means to present the data in a text format.
You can use XML to represent data which is stored in a RDBMS. Naturally you can see that just because your query is presented as Document Nodes, and/or translated to a document marked up according to some DTD, that the document or the object in memory is not the same thing as the data in the database.
XML in a text file is not "the data", unless that's where your application needs it. There are plenty of applications for XML where the data never sees ascii at all.
Read up on JAXB.
Re:XML is NOT just text! (Score:1)
What is the meaning of your sig? I am curious, because I feel that the lack of two-phase commit is one of the major issues preventing the open-source rdmbs servers from competing fully with Oracle. I was curious if your sig was related to this issue.
maru
Re:XML is NOT just text! (Score:2)
'jfb
Re:XML is NOT just text! (Score:3, Insightful)
So, no, XML is not editable in emacs (or vi), grep-able, diff-able or understandable to the naked eye. Go and think about it again.
yes it is.. just because you claim that "you're doing it wrong," doesn't mean it's impossible.
xml is text just as much as html is.. are you going to tell me that html isn't editable in emacs or human-readable? how is html different from DocBook, for example?
Re:XML is NOT just text! (Score:2, Insightful)
I couldn't agree less. In fact, XML is one possible representation of the abstract hierarchical data structure you described. Furthermore, XML is in fact a text representation. There are many other ways you could represent that data structure (eg: a custom binary format, records in a relational or hierarchical database, a object serialised to a binary stream etc) but none of them are XML.
The W3C themselves say that "XML is text [w3.org]" and then go on to point out that advantages of being a text format include:
They also say: "Like HTML, XML files are text files that people shouldn't have to read, but may when the need arises".
In parallel with the development of XML, our notion of the definition of 'text' has also moved forward. Through the adoption of standards like Unicode and bridging facilities like encoding declarations, we have moved past 7-bit ASCII as being the one true text.
To claim that an XML file is not "editable in emacs (or vi), grep-able, diff-able or understandable to the naked eye" is demonstrably untrue. You'll obviously need a text editor that understands whichever encoding the file uses (both emacs and vim fit that bill) but a text editor is a perfectly servicable tool for viewing and editing XML (obviously not the best tool in many cases, but acceptable nontheless)
Re:XML is NOT just text! (Score:2)
The point is that the document conforms to a certain structure: either rigidly (as when validating against a DTD or similar schema definition), loosely (as with well-formed XML, where elements must be closed correctly, but you can mix any elements and attributes you want), or something in between.
It's not obvious at all that Perl is a natural mix for processing XML. The things which Perl does so well - line-by-line file processing, string operations, regular expressions - are not very useful on XML. (For example you cannot match a balanced tree structure with a regular expression, so you can't use the standard string processing to do something so simple as extract an element and its contents.) Indeed they may lead you in a false direction at first. For quick throwaway tools, where the file is already pretty-printed in a certain way, Perl string operations may do the trick; for building applications that need to handle XML they are inadequate.
To read and write XML you will need libraries, and that is the case in any language. Perl has a good selection including the standard-API-but-very-slow XML::DOM, the nonstandard-API-but-useful XML::Twig, and the I-used-to-use-it-but-IMHO-it-is-best-avoided XML::Simple. But using these libraries isn't particularly easier from Perl than from any other language.
The ideal XML processing language would have a type system which could check at compile time whether the output you are generating will be valid for the DTD you have chosen; and it would also map the XML's DTD or schema onto the language's type system at input. For example, no need to get the list of child elements and get the first element from it, if the DTD specifies that there must be exactly one child.
Re:XML is NOT just text! (old school answer) (Score:1)
My $.02 : XML is composed of text because it only allows ascii characters. Thats it. Well-formed XML "the language" requires more definitions, but an xml "file" is just another text file format. You're talking about nondeterministic finite automata [unimi.it] quintuple that specifies how XML is parsed. understood, etc. But within that quintuple, I is the set of all ascii characters >= 32 and 128. At least I think that's true. Can someone post if I'm wrong? I appreciate learning of my misconceptions.
Re:XML is NOT just text! (old school answer) (Score:1)
Re:XML is NOT just text! (Score:3, Insightful)
I'll respond to you though many others are making similar arguments. First of all, when you say "XML is NOT just text!" do you mean "XML is NOT merely text" or "XML is not solely text"? I'll agree with the first, but the second is generally not true.
What noone seems to be mentioning is what you get out of those libraries: you get the entire structure in nodes thanks to the library's parser, but what are the contents of those nodes? Text! You might argue that the element names and most of the attributes are either defined by the dtd/schema, etc. but at least CDDATA will often be abitrary text. And, at least in my experience (mostly web-based applications), there will often be a need to process some of that text, e.g. extract links which are embedded in the text, convert newlines to <br>s, and many other things. And then, isn't it handy when the language reading the contents of those nodes has strong text-handling abilities?
Just a thought.
-chris
Re:XML is NOT just text! (Score:2)
Actually, the whole point of XML is that it is just a string of text.
If XML parsers used a file format that wasn't human-readable text, there would be little point in using it, and we would all just stick with object-model databases.
Natural? (Score:1, Redundant)
Not really. If you're using XML as "just another text format", then you're making a funamental mistake. Within your software, you should always be treating XML as a hierarchical data structure, not as a text stream. Apart from manipulating CDATA or attribute value text, Perl has no particular strength with XML.
Re:Natural? (Score:3, Informative)
Indeed, the perl only XML libraries are quite slow. I believe most of the quality perl XML handling is done by modules that use C libraries to do the grunt work. However, if the data in the XML itself is text data, then of course, perl and XML are a good match. Add SOAP and mod_perl into the mix, and you got some very nifty tools.
Petal (Score:4, Informative)
One new, and cool, Perl XML module that people might not know about is Petal [cpan.org] (PErl Template Attribute Language).
It is an implementation of the Zope TAL (Template Attribute Language) specification [zope.org] and it basically allows you to create XML templates where all the templating commands are just attributes of existing tags.
This allows things like XHTML templates which are very WYSIWYG friendly since the editors don't do anything with attributes that they don't know about.
This was a review? (Score:4, Insightful)
How effective were the examples? How easy to read and understand were the general concepts? Were the descriptions of libraries and API's clear? Was the writing generally readable?
Would this book even make a good reference?
Jeez, anyone want to follow up the post with a real review?
XML frees us from Perl (Score:5, Interesting)
(For reference, see this rant [underlevel.net] by the brilliant net.kook Erik Naggum. The most quotable bit, for the lazy among you, is
)Re:XML frees us from Perl (Score:1)
The whole point of XML is to free us from having to do the kinds of things Perl is meant for. Absent free-form text munging, Perl really has no advantage over other languages. At the same time, it has real deficits for people who need to know they have solved a problem correctly and completely.
I essentially agree with you but one still has the problem of merging a non-xml document into xml form. Here perl can be fairly useful.
Re:XML frees us from Perl (Score:2)
That's true, but the Perl XML-handling modules are not much help for that.
Re:XML frees us from Perl (Score:2, Informative)
Not much help? If you start counting the number of Perl modules that expose a SAX interface to non-XML data (not to mention the host of other super-useful SAX tools) you'll probably find only one egal, Python.
And if you think that XML has freed us from additional text processing, you obviously haven't used XML much, or at least without much variety. Most people seem constantly bent on including microlanguages in attribute values or text content. Those need good text processing.
Perl is a reflection of your soul (Score:4, Interesting)
If is possible to write quality code in Perl Just because the language allows you to not do so isn't its fault. It doesn't stop you from doing it, because that'd stop you from doing brilliant things.
To address some specific things you mentioned, you can do full-fledged exception handling in Perl if you want to (with eval and specific modules), or, you know, not. And I'm not familiar with the false positive matches in regexps (perhaps you're referring to some famous problem). But if a regexp doesn't do what you want it to, isn't is wrong? Between
Re:XML frees us from Perl (Score:5, Insightful)
A what? You (or rather the brilliant person being quoted) either mean that it matches a string that the expression isn't supposed to, which would be a serious bug in the language (and I am not aware of any such bugs); or you mean that it matches correctly, but matches things you didn't expect it to, in which case you tell, by (gasp!) testing your code. In any case, how do you tell a "false positive" regexp match in Java?
but you can't write an elegant, maintainabale program that becomes an asset to both you and your employer
Perhaps you can't. I have, and I do.
Re:XML frees us from Perl (Score:2)
Re:XML frees us from Perl (Score:1, Interesting)
Okay, I'll bite.
So how does XML do that in, let's say, system administration?
So ehmm... what type of things is XML made out of? Elements' names, contents, etc, it's all text.
You can write a dirty hack in any language. And about the last part: what about CPAN [cpan.org]?
That would be by understanding the regex, just as any other chunk of code. (Funny, that... When you want to say something bad about Perl, moan about its horrible, illegible, etc regexes. When you want to mention something positive about another language -- especially when comparing to Perl -- mention support for powerful, fast, etc regexes. And advertised as "Perl-compatible" at that.)
-- Arien
Re:XML frees us from Perl (Score:2)
When config files are in XML, they can be munged programmatically without regexp hackery.
He goes on, "... what type of things is XML made out of? Elements' names, contents, etc, it's all text."
It's not free-form text, it's structured text. Somebody else pointed out, though, that there is a distressingly large amount of free-form text to be parsed in attribute strings, body text, and (!) comments, that XML structure extraction tools don't help with.
(I won't answer criticism of Naggum's rant; he's not known as a net.kook for nothing. Take it up with him.)
Re:XML frees us from Perl (Score:3, Insightful)
Yes, $dd->updsp( 1,3, @ad ) looks worse than $Driver->update_displays( $Display:LOBBY, $Display:CUSTSERV, @additional ), and boy it's just a shame that perl doesn't let me use meaningful identifiers or document API's or forward declare functions for arg checking ahead of time. Oh wait... Really. The argument is dead, continuing to raise it is just trolling.
I switched to python because I got tired of leaning on my shift key. Tcl has probably the prettiest syntax for me, but as a language it's braindead beyond belief (not to mention slow)
Re:XML frees us from Perl (Score:1)
Absolutely. Once you get beyond text parsing by standadizing the syntax, the goal of a program is to manipulate objects. XML maps very well into object trees and that is why it is commonly processed using Java and Python. If you want the powerful capabilities of a dynamically typed language, with a simple, easy to learn grammer, then you should use Python for processing XML, not Perl. (Perl's object syntax is as obtuse as the rest of the language and offers no advantages over the elegant object model of Python. In fact, Larry Wall borrowed much of the Perl object design from Python. Use the genuine original, not the imitation.) The standard Python library includes a fine package for navigating through XML data and zero text processing code needs to be written to do this. It's objects all the way down.
There is a good article [xml.com] that explains how to use Python generators to process XML content. This is something you will never be able to do as easily in either Java or Perl.
Re:XML frees us from Perl (Score:1)
Let's reinvent the wheel again (Score:2)
Re:Let's reinvent the wheel again (Score:2)
That happened years ago: the Apache XML project's AxKit [axkit.org].
Re:Let's reinvent the wheel again (Score:1)
You need to move on from thinking that everything is there purely to be used for the web. Well over half of the work I've done with XML and Perl has nothing to do with the web.
Re:Let's reinvent the wheel again (Score:2)
Re:Let's reinvent the wheel again (Score:2)
Although I agree that Perl/XML sounds like a powerful and flexible way to serve dynamic content...
I am using Perl, XML, and Apache but it has nothing to do with serving up content for the web (or humans, for that matter). Don't think of XML as a better HTML for web pages. It's a lot more.
i hate perl... (Score:2)
but i disagree. Perl absoulely RIPS through this stuff, unlike the Java stuff i've written. sometimes, there's nothing like some good, old-fashioned procedural code to munge one document into another.
the only problem i had was with UTF-8 stuff. perl really wasn't quite there until perl 5.8, and i'm having trouble finding installs of it on the machines i need to use it on at the university i work for.
Re:i hate perl... (Score:1, Flamebait)
Re:i hate perl... (Score:2, Insightful)
Well, shit. I once rewrote a Perl parser in *Perl* and went from 9hrs to 45mins. What the hell kind of flame-bait shit is this!?
It is true that extremely well-written C code can outperform perl code at anything. It is also true that for things that perl is made for (like ripping through tons of text-data), a typical Perl program will *most likely* do it better than a typical C program, simply because it is making use of more optimized underlying algorithms (even though the actual execution structure is slightly more bloated than C... double-dereferencing pointers, compile-time imediately before run-time, etc).
Also, Java has all the same disavantages with respect to C... that is more insulation from the *actual* memory (no such thing as a real pointer in either, garbage-collection, etc).
Anyway, bottom-line is this. If what you say is at all true, then you had a shittily-written Perl program. I promise you that I can write just as shitty a program in Java... does that mean that we should trash Java?!?!? Abso-f*cking-lutely not! I'll do you one better, too: I'll write just as shitty and slow of a parser in Java that doesn't even *look* that bad to someone who doesn't understand the subtleties behind such simple abstractions as strings, lists and arrays.
I'm very serious with what I said originaly, I have, in fact, taken a Perl parser (a super-light-weight XML parser, actually) and reduced the parse-time by several orders of magnitude. The idiot who wrote it originaly (myself), went walking through the string or stream looking for 's (with a regexp), at the highest level. It is *terribly* slow to strip leading characters off of a long string in Perl (I'm pretty sure that it copies the whole goddamn string, minus those 10 (or however many) characters on the front). I made a *very* simple change, namely this:
# split on positive lookahead assertion of a ''
# then we just deal individually with blocks of text that all start
# with a ''... should save time
my @xml = split(/(?=)/,' '.$xml);
shift @xml;
And, you'll note that I f*cking commented it (something which people just don't seem to understand when they trash perl). Bang! Many orders of magnitude in speed improvement. Simple.
Anyway, pull your head out of your ass.
Friggin less-than's (Score:1)
Oh, well. You know what I meant.
Re:Friggin less-than's (Score:1)
(it's funny, laugh.)
Re:Friggin less-than's (Score:1)
if ($form{Format} eq 'Plain Old Text') {
$form{Comment} =~ s/&/&/g;
$form{Comment} =~ s/</>/g;
$form{Comment} =~ s/>/</g;
}
bing-bang-boom. How hard was that?
Re:Friggin less-than's (Score:1)
Plain old text is not plain text. FAQ claims the following:
HTML Formatted: You determine the formatting, using allowed HTML tags and entities.
Plain Old Text: Same as "HTML Formatted", except that
is automatically inserted for newlines, and other whitespace is converted to non-breaking spaces in a more-or-less intelligent way.
Extrans: Same as "Plain Old Text", except that & and are converted to entities (no HTML markup allowed).
Code: Same as "Extrans", but a monospace font is used, and a best attempt is made at performing proper indentation.
So it seems that "Extrans" (whatever that is supposed to mean) would have done the job...
Re:i hate perl... (Score:2)
ha ha ha
The Right Tool for the Right Job (Score:2, Funny)
Re:The Right Tool for the Right Job (Score:1)
That's because you see XML more or less as an object serialisation syntax when it has been proven over and over again that there's serious impedance mismatch between those two views (at least, with Java's rather limited view of OO). See XML Schema if you don't think so.
Don't forget that the Desperate Perl Hacker was in the requirements for XML. And they succeeded pretty well in making XML match Perl.
Re:The Right Tool for the Right Job (Score:2)
http://sax.perl.org/
It's just as natural to do OO w/Perl as it is doing text parsing. Perl just doesn't force you to do it one way.
If you REALLY want to buy the book (Score:1, Offtopic)
Please Rob, explain to us how whatever deal you have with bn.com is worth your user base overpaying by so much? Users can buy the book through the link above, and I will put a third of my affiliate commission (about $1.40 per copy) towards Perl development projects [affero.net]. This way everybody wins. Using your link, I assume you win, and that bn wins, but your loyal user base is out an additional $12 and I can't imagine your deal with bn.com nets you that much for providing the link.
Re:If you REALLY want to buy the book (Score:4, Informative)
Re:If you REALLY want to buy the book (Score:1)
They can't really abuse the patent, they can only take advantage of it. If you want to boycott anyone over their one-click patent, boycott the US government that issued them the patent. If you think the patent was issued in error, then provided the prior art to discredit the patent.
Except that unless you buy another book to get over BookPool's $40 Free Shipping threshhold you will just be paying that $3 to UPS instead of me and the Perl Development Fund. Amazon's Free Shipping [amazon.com] threshhold of $25 falls conveniently just under their price for the book [amazon.com].
Re:If you REALLY want to buy the book (Score:3, Informative)
So, where's the review? (Score:4, Insightful)
I know complaining about slashdot stories is like shooting those proverbial barreled fish, but sheesh.
Re:So, where's the review? (Score:2)
That was my thought exactly. I could get more depth by going to the publisher's website [newriders.com] than I can get out of this review. At least the publisher gives me a couple of sample chapters to form an opinion around.
XML::Simple (Score:2, Interesting)
Re:XML::Simple (Score:2)
Writing a SAX handler is invaluable for parsing huge XML files. There's only do much you can fit in memory.
XML doesn't create regular languages... (Score:2)
hasn't received much attention until recently? (Score:5, Informative)
The reviewer is correct, Perl is a good tool for slamming and jammin' text, including XML. What I'm not so sure of is the quote "It's therefore surprising that using Perl for XML processing hasn't received much attention until recently."
I mean one need only scroll down the extensive list of CPAN Modules [cpan.org] to see well over 50, as well as many sites/authors devoting [cpan.org] time, energy and resource.
Similarly, I would point out some press modules supporting web services via XML, such as SOAP::Lite as far back as 02/26/01 [netscape.com] and XML-RPC also in '01 [sourceforge.net] -- or O'Reilly's own XML.com with articles such as "Processing XML with Perl [xml.com]" written shortly after the turn of the millenium.
Point is, though I personally love Perl, blatant plugs such as "... it's just that the world outside of the Perl community doesn't seem to have taken much notice of this work. This is all set to change with the publication of this book and O'Reilly's Perl and XML." " don't inspire confidence in the reviewer's objectivity.
Re:hasn't received much attention until recently? (Score:1)
He wrote Manning's "Data Munging with Perl". Which is all about "slamming and jammin' text, including XML". In fact, it's got a reasonably large section on XML.
But he doesn't mention it, and he doesn't push it. Instead he recommends two books from different publishers, neither of which he works for. As far as I know he doesn't provide any content for O'Reilly's oreillynet, but I may be wrong there.
People who use Perl, and are part of the Perl community, know that you can slice and dice XML wuith Perl. What Dave is trying to say is that the managers and Java/Python/whatever programmers aren't so aware of this.
Axkit, perl & XML so happy together (Score:2, Informative)
"Apache AxKit is an XML Application Server for Apache. It provides on-the-fly conversion from XML to any format, such as HTML, WAP or text using either W3C standard techniques, or flexible custom code. AxKit also uses a built-in Perl interpreter to provide some amazingly powerful techniques for XML transformation."
picture coccoon for perl. using perl for xsp pages and doing pipline transformations on xml. great stuff.
use AxKit! (Score:1)
Also read this [monasticxml.org]
simon
XML makes Perl less important (Score:2)
Re:XML makes Perl less important (Score:2)
Part of the Problem (Score:1)
Perl lousy for parsers. (Score:2)
You can write such parsers as regular expressions, but that makes them even slower.
Despite this, I parse millions of lines of SGML/HTML/XML into trees of HTML::Element, using only Perl. But it's clunkier than it should be.
Re:It's a great book about a terrific subject (Score:1)
Re:Who cares about Perl? (Score:1)
In fact I have been looking into perl-xml for processing of scalc spreadsheets that our stores send to us every day. It has been a valuable tool and we would be up a creek with Windows tools trying to do the exact same thing.
--Travis
Re:Formalised features of Perl (in this book?) (Score:2, Interesting)
In practice, reference counting doesn't seem to lead to memory leaks as you describe. And, I would argue it is much more efficient than Java's method.
PERL is an excellent SCRIPTING language. Larry Wall describes it as a "glue" language. XML is a good thing to glue together. It's perfect for that. Every tool has its purpose; push any too far, and you start abusing it.
Trying to find the quote from Larry Wall. I think it goes something like this: "Perl did easy things easily and made impossible things doable."
Re:Formalised features of Perl (in this book?) (Score:1)
As you're also aware, most Comp Sci courses fawn over Pascal, a VERY formalized language. However, it's not mentioned much past education circles (and Apple afficionados).
Ever heard of Borland's Delphi product? The language is object-Pascal.
Re:Formalised features of Perl (in this book?) (Score:1)
Just because you CAN doesn't necessarily mean you SHOULD (i.e. Object-C).
Re:A simple answer to the question: (Score:1)
Though XML itself may look easy, I can asure you that the technical incompetent won't like the standards written around XML a bit. Schema's and XSLT take a while to get used to.
Furthermore, you do not have to write an application to parse XML at all. It has been done already. You will be presented with the DOM or with SAX. With the DOM you get a pre-parsed tree structure and with SAX you will be called back if it has found your data. 95% of the people in these discussions will know this.
The only conclusion I can draw from your writing is that you are as deep in XML as the writer of the original article: not at all. You see XML as just a text-file with some data in it. Other
Warper
can anybody rewrite _all_ the linux configuration files to xml please? before lunch?