From: Grant M. <gr...@us...> - 2002-06-19 21:29:45
|
Update of /cvsroot/perl-xml/perl-xml-faq In directory usw-pr-cvs1:/tmp/cvs-serv28934 Modified Files: perl-xml-faq.xml Log Message: - added a section on rolling your own parser in Perl (or not) - fixed maintainer name for XML::LibXML Index: perl-xml-faq.xml =================================================================== RCS file: /cvsroot/perl-xml/perl-xml-faq/perl-xml-faq.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- perl-xml-faq.xml 3 May 2002 19:49:02 -0000 1.8 +++ perl-xml-faq.xml 19 Jun 2002 21:29:41 -0000 1.9 @@ -35,7 +35,8 @@ <ulink url="http://www.perlxml.net/perl-xml-faq.dkb">http://www.perlxml.net/perl-xml-faq.dkb</ulink>. The official source for this document is in CVS on <ulink url="http://www.sourceforge.net/">SourceForge</ulink> at <ulink - url="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/perl-xml/perl-xml-faq/">http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/perl-xml/perl-xml-faq/</ulink></para> + url="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/perl-xml/perl-xml-faq/" + >http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/perl-xml/perl-xml-faq/</ulink></para> </abstract> @@ -366,7 +367,46 @@ </answer> </qandaentry> - + + <qandaentry id="roll_your_own"> + <question> + <para>Rolling your own parser</para> + </question> + <answer> + + <para>You may be tempted to develop your own Perl code for parsing XML. + After all, XML is text and Perl is a great language for working with + text. But before you go too far down that track, here are some points + to consider:</para> + + <itemizedlist mark="bullet"> + + <listitem><para>Smart people don't. (Actually a number of really smart + people have - that's why there's a range of existing parsers to chose + from).</para></listitem> + + <listitem><para>It's harder than you think. The first major hurdle is + <link linkend="encodings">encodings</link>. Then you'll have to handle + DTDs - even if you're not doing validation. The feature list will also + need to include numeric and named entities, CDATA sections, processing + instructions and well-formedness checks. You probably should support + namespaces too.</para></listitem> + + <listitem><para>If you haven't done all that, it's not XML. It might + work for that subset of XML that you deem to be important, but if you + can't exchange documents with other parties, what's the + point?</para></listitem> + + <listitem><para>Even if it works it will be slow.</para></listitem> + + </itemizedlist> + + <para>If none of the existing modules have an API that suits your needs, + write your own wrapper module to extend the one that comes closest.</para> + + </answer> + </qandaentry> + </qandadiv> <qandadiv id="cpan_modules"><title>CPAN Modules</title> @@ -478,12 +518,13 @@ </question> <answer> - <para>Matt has also written <classname>XML::LibXML</classname> - a Perl - wrapper around the GNOME Project's libxml2 library. It is very fast, - complete and stable. It can run in validating or non-validating modes - and offers a DOM with XPath support. The DOM and associated memory - management is implemented in C which offers significant performance - advantages over DOM trees built from Perl datatypes. The + <para><classname>XML::LibXML</classname> provides a Perl wrapper around + the GNOME Project's libxml2 library. This module was originally written + by Matt Sergeant and is now actively maintained by Christian Glahn. It + is very fast, complete and stable. It can run in validating or + non-validating modes and offers a DOM with XPath support. The DOM and + associated memory management is implemented in C which offers significant + performance advantages over DOM trees built from Perl datatypes. The <classname>XML::LibXML::SAX::Builder</classname> module allows a libxml2 DOM to be constructed from SAX events.</para> |