<link href="/assets/64d0ba83aa42c90354ff97799bcfc0c2.css" type="text/css" rel="stylesheet"> <script src="/assets/6fd6663d5303bb7eda3ef7493fc29db6.js"></script> <script> $(document).ready(function() { anchors.options = { visible: 'hover', placement: 'right', truncate: 64 }; anchors.add('#body h2, #body h3, #body h4, #body h5'); }); </script> <script> hljs.initHighlightingOnLoad(); </script>

<h3>Programmation XML en Perl</h3> <h4> Modules Perl existant</h4> <p>Voir <a href="http://perl-xml.sourceforge.net/faq/">Perl-XML Frequently Asked Questions</a></p> <p>Il existe de nombreux modules permettant de manipuler le XML en Perl. Un des module les plus performant est <a href="http://search.cpan.org/perldoc?XML%3A%3ALibXML=1">XML::LibXML</a>, qui s’appuie sur la bibliothèque <a href="http://xmlsoft.org">libxml2</a>. On peut l’associer au module <a href="http://search.cpan.org/perldoc?XML%3A%3ALibXSLT=1">XML::LibXSLT</a> qui permet d’appliquer des feuilles de style XSLT.</p> <h4>Installation de XML::LibXML et XML::LibXSLT</h4> <ul> <li>Sous <strong>linux</strong> : XML::LibXML et XML::LibXSLT sont disponibles pour la plupart des distributions sous forme de paquetages. Sinon , installez libxml2 et libxslt puis utilisez la commande <code>cpan</code> (exemple : <code>cpan -i XML::LibXML</code>).</li> </ul> <!-- --> <ul> <li>Sous MacOS X : D’après le <a href="http://kobesearch.cpan.org/htdocs/XML-LibXML/README.html">README</a> : <em>It is confirmed that XML::LibXML builds and runs without problems since Mac OS X 10.2.6.</em>. L’installation avec cpan doit marcher, mais je ne connais pas Mac OS X…</li> </ul> <!-- --> <ul> <li>Sous Windows : <ul> <li>Avec <strong>cygwin</strong>, l’installation semble compliquée : je n’ai pas réussi</li> <li>Avec <a href="http://perl-xml.sourceforge.net/faq/#xml_parser">ActivePerl</a>, suivre les instructions <a href="http://perl-xml.sourceforge.net/faq/#win32_ppm">ici</a></li> </ul></li> </ul> <h4>Exemples</h4> <p>Un exemple de programme associant l’utilisation de XML::LibXML et XML::LibXSLT : <a href="/cours/programmation_xml/programmation_perl/xml_perl.zip">xml_perl.zip</a></p> <p>Autres exemples: <a href="/cours/programmation_xml/programmation_perl/xml_perl2.zip">xml_perl2.zip</a></p>