|
From: Grant M. <gr...@us...> - 2002-04-17 20:45:53
|
Update of /cvsroot/perl-xml/perl-xml-faq
In directory usw-pr-cvs1:/tmp/cvs-serv31262
Modified Files:
perl-xml-faq.xml
Log Message:
- added CVS revision keywords
- added id attributes to qandadivs
- added XML::Simple FAQ link
- added writeup on Win32::OLE + MSXML
- minor formatting tweaks
Index: perl-xml-faq.xml
===================================================================
RCS file: /cvsroot/perl-xml/perl-xml-faq/perl-xml-faq.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- perl-xml-faq.xml 4 Apr 2002 21:35:22 -0000 1.3
+++ perl-xml-faq.xml 17 Apr 2002 20:45:49 -0000 1.4
@@ -13,6 +13,14 @@
<year>2002</year>
<holder>Grant McLean</holder>
</copyright>
+
+ <revhistory>
+ <revision>
+ <revnumber>$Revision$</revnumber>
+ <date>$Date$</date>
+ </revision>
+ </revhistory>
+
<legalnotice>
<para>This work is distributed under the terms of Perl's Artistic License.
@@ -28,7 +36,7 @@
<qandaset defaultlabel="number">
-<qandadiv><title>Tutorial and Reference Sources</title>
+<qandadiv id="docs"><title>Tutorial and Reference Sources</title>
<qandaentry id="tutorials">
<question>
<para>Where can I get a gentle introduction to XML and Perl?</para>
@@ -143,7 +151,7 @@
</qandaentry>
</qandadiv>
-<qandadiv><title>Selecting a Parser Module</title>
+<qandadiv id="parser_selection"><title>Selecting a Parser Module</title>
<qandaentry id="dont_parse">
<question>
@@ -338,7 +346,7 @@
</qandadiv>
-<qandadiv><title>CPAN Modules</title>
+<qandadiv id="cpan_modules"><title>CPAN Modules</title>
<para>This section attempts to summarise the most commonly used XML modules
available on CPAN. Many of the modules require that you have certain
@@ -408,7 +416,10 @@
used for more general purpose XML work too. The 'simple tree' data
structure is nothing more than standard Perl hashrefs and arrays - there
is no API for finding or transforming nodes. This module is also not
- suitable for working with 'mixed content'.</para>
+ suitable for working with 'mixed content'.
+ <classname>XML::Simple</classname> has it's own <ulink
+ url="http://web.co.nz/~grantm/cpan/xmlsimple/faq.html">frequently asked
+ questions</ulink> document.</para>
<para>Although <classname>XML::Simple</classname> uses a tree-style, the
module also supports building the tree from SAX events or using a simple
@@ -482,6 +493,48 @@
</answer>
</qandaentry>
+ <qandaentry id="msxml">
+ <question>
+ <para><classname>Win32::OLE</classname> and MSXML.DLL</para>
+ </question>
+ <answer>
+
+ <para>If you're using a Windows platform and you're not worried about
+ portability, Microsoft's MSXML provides a DOM implementation with
+ optional validation and support for both XPath and XSLT. MSXML is a
+ COM component and as such can be accessed from Perl using
+ <classname>Win32::OLE</classname>. Unfortunately this means you can't
+ get at the documentation with the usual <command>perldoc</command>
+ command, so here's a code snippet to get you started:</para>
+
+ <programlisting><![CDATA[
+use Win32::OLE qw(in with);
+
+my $xml_file = 'your file name here';
+my $node_name = 'element name or XPath expression';
+
+my $dom = Win32::OLE->new('MSXML2.DOMDocument.3.0') or die "new() failed";
+
+$dom->{async} = "False";
+$dom->{validateOnParse} = "False";
+$dom->Load($xml_file) or die "Parse failed";
+
+my $node_list = $dom->selectNodes($node_name);
+foreach my $node (in $node_list) {
+ print $node->{Text}, "\n";
+}
+ ]]></programlisting>
+
+ <para>Shawn Ribordy has written <ulink
+ url="http://www.perl.com/pub/a/2001/04/17/msxml.html">an article about
+ using MSXML from Perl</ulink> at <ulink
+ url="http://www.perl.com">www.perl.com</ulink>. You can find reference
+ documentation for the MSXML API on <ulink
+ url="msdn.microsoft.com">MSDN</ulink>.</para>
+
+ </answer>
+ </qandaentry>
+
<qandaentry id="xml_sax">
<question>
<para><classname>XML::SAX</classname></para>
@@ -698,7 +751,7 @@
</qandadiv>
-<qandadiv><title>Encodings</title>
+<qandadiv id="encodings"><title>Encodings</title>
<qandaentry id="encodings_why">
<question>
@@ -1119,7 +1172,7 @@
</answer>
- <answer id="sax_encodeto">
+ <answer id="sax_writer">
<formalpara>
<title>XML::SAX::Writer</title>
@@ -1231,7 +1284,7 @@
</qandadiv>
-<qandadiv><title>Validation</title>
+<qandadiv id="validation"><title>Validation</title>
<para>The XML Recommendation says that an XML document is 'valid' if it
has an associated document type declaration and if the document complies
@@ -1284,7 +1337,7 @@
<!ELEMENT email (#PCDATA)>
]]></programlisting>
- <para>Here's an XML document that refer's to the DTD:</para>
+ <para>Here's an XML document that refers to the DTD:</para>
<programlisting><![CDATA[
<?xml version="1.0" ?>
@@ -1377,7 +1430,7 @@
</qandadiv>
-<qandadiv><title>Common Coding Problems</title>
+<qandadiv id="coding_problems"><title>Common Coding Problems</title>
<qandaentry id="error_handling">
<question>
@@ -1510,7 +1563,7 @@
</qandadiv>
-<qandadiv><title>Common XML Problems</title>
+<qandadiv id="xml_problems"><title>Common XML Problems</title>
<para>The error messages and questions listed in this section are not really
Perl-specific problems, but they are commonly encountered by people new to
@@ -1560,7 +1613,7 @@
</answer>
</qandaentry>
- <qandaentry id="no_quotes">
+ <qandaentry id="not_well_formed">
<question>
<para>'not well-formed (invalid token)'</para>
</question>
@@ -1571,7 +1624,7 @@
</answer>
- <answer>
+ <answer id="no_quotes">
<formalpara>
<title>Unquoted attributes</title>
@@ -1593,7 +1646,7 @@
</answer>
- <answer>
+ <answer id="bad_encoding_decl">
<formalpara>
<title>Bad encoding declaration</title>
@@ -1643,16 +1696,15 @@
<programlisting><![CDATA[
<!DOCTYPE doc [
- <!ENTITY eacute "é" >
- <!ENTITY euro "€" >
+ <!ENTITY eacute "é" >
+ <!ENTITY euro "€" >
]>
-
<doc>Combien avez-vous payé? 125 €</doc>
]]></programlisting>
<para>You can find the definitions for <ulink
url="http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_XHTML_Latin_1_Character_Entities"
- >HTML Latin 1 characters entities</ulink> on the W3c Site.</para>
+ >HTML Latin 1 characters entities</ulink> on the W3C Site.</para>
<para>You can include all these character entities into your DTD, so that
you won't have to worry about it anymore:</para>
@@ -1724,7 +1776,7 @@
</qandadiv>
-<qandadiv><title>Miscellaneous</title>
+<qandadiv id="misc"><title>Miscellaneous</title>
<qandaentry id="mailing_list">
<question>
@@ -1783,7 +1835,7 @@
</qandaset>
-<section><title>Corrections, Contributions and Acknowledgements</title>
+<section id="corrections_etc"><title>Corrections, Contributions and Acknowledgements</title>
<para>This document is a 'work in progress'. A number of questions are
still being worked on and will be added when they are complete.</para>
|