Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Which is the Best Perl XML Tool?

by mirod (Canon)
on Jan 18, 2001 at 03:17 UTC ( [id://52635]=note: print w/replies, xml ) Need Help??


in reply to Which is the Best Perl XML Tool?

Could you develop Xerces is or will be the standard for processing XML in CGI? I don't understand this sentence.

I also don't know very well the Xerces Perl wrapper.

What I know is that I _HATE_ the DOM. Not only is it clumsy and verbose, I also think it leads to insecure programming (a well placed comment in the XML can usually crash a DOM program). So I guess you have my position on Xerces ;--)

An other pretty popular alternative to generate HTML from XML using XSLT and XPath-based Perl scripts is Matt Sergeant's AxKit, you might want to have a look at it.

Replies are listed 'Best First'.
(fongsaiyuk)Re: Re: Which is the Best Perl XML Tool?
by fongsaiyuk (Pilgrim) on Jan 18, 2001 at 09:22 UTC
    What I know is that I _HATE_ the DOM. Not only is it clumsy and verbose, I also think it leads to insecure programming (a well placed comment in the XML can usually crash a DOM program). So I guess you have my position on Xerces ;--)

    Doesn't Xerces validate the XML document? If a document is validated can it still cause a DOM program to crash?

    I do not deny that DOM processing has very high overhead compared to straight XML::Parser, especially with very large XML documents, but that is the nature of DOM. Easy to understand the tree concept of data but costly, in terms of resources, to realize.

    TIA for your comments,

    fongsaiyuk

      If a document is validated can it still cause a DOM program to crash?

      The problem is that IMHO the DOM only offers one safe method to select elements: getElementsByTagName. This will always behave properly in a DWIM way. All the navigation functions, such as getFirstChid, getLastChild, getPreviousSibling and getNextSibling return a node. Now what if that node is a comment? How many of the DOM scripts out there check every time they use one of those methods that the result is really what they expected, usually an element? Remember that even if the DTD says that a dt is always followed by a dd there can be any number of comments and processing instructions in between. Who codes that defensively and systematically writes this?

      my $dd= $dt; $dd= $dt->getNextSibling until( $dd->getNodeName eq 'Element');

      Hence my guess that a well placed comment can probably wreak havoc in most of the DOM code around (and certainly in most of my own tries at taming the DOM). Practically I suspect people code for a subset of XML, one that excludes comments and processing instructions. This is dangerous for the exact same reasons I described in On XML parsing.

Re: Re: Which is the Best Perl XML Tool?
by sierrathedog04 (Hermit) on Jan 18, 2001 at 22:19 UTC
    Someone asked why I think Xerces will become the standard way to do CGI.

    I recently took a class in XML from Northern Virginia Community College. The instructor seemed very knowledgeable in most areas (other than the DOM). He mentioned the Java XML parser built into the Apache Xerces project as being very advanced.

    I visited the Apache Xerces site and it does seem that Xerces is an advanced project. The tie-in with Apache must help a lot, because a lot of us at work do CGI on an Apache server.

    I wonder whether mere roll-your-own programming is going to be enough. With the Apache people running a full-blown effort to develop XML tools for Apache it seems to me that soon most non-Perl people doing Apache CGI work would want to use these tools.

    That is what I meant.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2024-04-23 14:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found