1LibXML(3) User Contributed Perl Documentation LibXML(3)
2
3
4
6 XML::LibXML - Perl Binding for libxml2
7
9 $Version_String = XML::LibXML::LIBXML_DOTTED_VERSION;
10 $Version_ID = XML::LibXML::LIBXML_VERSION;
11 $DLL_Version = XML::LibXML::LIBXML_RUNTIME_VERSION;
12 $libxmlnode = XML::LibXML->import_GDOME( $node, $deep );
13 $gdomenode = XML::LibXML->export_GDOME( $node, $deep );
14
17 use XML::LibXML;
18 my $parser = XML::LibXML->new();
19
20 my $doc = $parser->parse_string(<<'EOT');
21 <some-xml/>
22 EOT
23
25 This module is an interface to the gnome libxml2 DOM and SAX parser and
26 the DOM tree. It also provides an XML::XPath-like findnodes() inter‐
27 face, providing access to the XPath API in libxml2. The module is split
28 into several packages which are not described in this section.
29
30 For further information, please check the following documentation:
31
32 XML::LibXML::Parser
33 Parsing XML Files with XML::LibXML
34
35 XML::LibXML::DOM
36 XML::LibXML DOM Implementation
37
38 XML::LibXML::SAX
39 XML::LibXML direct SAX parser
40
41 XML::LibXML::Reader
42 Reading XML with a pull-parser
43
44 XML::LibXML::Document
45 XML::LibXML DOM Document Class
46
47 XML::LibXML::Node
48 Abstract Base Class of XML::LibXML Nodes
49
50 XML::LibXML::Element
51 XML::LibXML Class for Element Nodes
52
53 XML::LibXML::Text
54 XML::LibXML Class for Text Nodes
55
56 XML::LibXML::Comment
57 XML::LibXML Comment Nodes
58
59 XML::LibXML::CDATASection
60 XML::LibXML Class for CDATA Sections
61
62 XML::LibXML::Attr
63 XML::LibXML Attribute Class
64
65 XML::LibXML::DocumentFragment
66 XML::LibXML's DOM L2 Document Fragment Implementation
67
68 XML::LibXML::Namespace
69 XML::LibXML Namespace Implementation
70
71 XML::LibXML::PI
72 XML::LibXML Processing Instructions
73
74 XML::LibXML::Dtd
75 XML::LibXML DTD Support
76
77 XML::LibXML::RelaxNG
78 XML::LibXML frontend for RelaxNG schema validation
79
80 XML::LibXML::Schema
81 XML::LibXML frontend for W3C Schema schema validation
82
83 XML::LibXML::XPathContext
84 API for evaluating XPath expressions
85
86 XML::LibXMLguts
87 Internal of the Perl Layer for libxml2 (not done yet)
88
90 Sometimes it is usefull to figure out, for which version XML::LibXML
91 was compiled for. In most cases this is for debugging or to check if a
92 given installation meets all functionality for the package. The func‐
93 tiones XML::LibXML::LIBXML_DOTTED_VERSION and XML::LibXML::LIBXML_VER‐
94 SION provide this version information. Both functions simply pass
95 through the values of the similar named macros of libxml2. Similarly,
96 XML::LibXML::LIBXML_RUNTIME_VERSION returns the version of the (usually
97 dynamically) linked libxml2.
98
99 XML::LibXML::LIBXML_DOTTED_VERSION
100 $Version_String = XML::LibXML::LIBXML_DOTTED_VERSION;
101
102 Returns the version string of the libxml2 version XML::LibXML was
103 compiled for. This will be "2.6.2" for "libxml2 2.6.2".
104
105 XML::LibXML::LIBXML_VERSION
106 $Version_ID = XML::LibXML::LIBXML_VERSION;
107
108 Returns the version id of the libxml2 version XML::LibXML was com‐
109 piled for. This will be "20602" for "libxml2 2.6.2". Don't mix
110 this version id with $XML::LibXML::VERSION. The latter contains the
111 version of XML::LibXML itself while the first contains the version
112 of libxml2 XML::LibXML was compiled for.
113
114 XML::LibXML::LIBXML_RUNTIME_VERSION
115 $DLL_Version = XML::LibXML::LIBXML_RUNTIME_VERSION;
116
117 Returns a version string of the libxml2 which is (usually dynami‐
118 cally) linked by XML::LibXML. This will be "20602" for libxml2
119 released as "2.6.2" and something like "20602-CVS2032" for a CVS
120 build of libxml2.
121
122 XML::LibXML issues a warning if the version of libxml2 dynamically
123 linked to it is less than the version of libxml2 which it was com‐
124 piled against.
125
127 The modules described in this section are not part of the XML::LibXML
128 package itself. As they support some additional features, they are men‐
129 tioned here.
130
131 XML::LibXSLT
132 XSLT Processor using libxslt and XML::LibXML
133
134 XML::LibXML::Common
135 Common functions for XML::LibXML related Classes
136
137 XML::LibXML::Iterator
138 XML::LibXML Implementation of the DOM Traversal Specification
139
141 Note: THE FUNCTIONS DESCRIBED HERE ARE STILL EXPERIMENTAL
142
143 Although both modules make use of libxml2's XML capabilities, the DOM
144 implementation of both modules are not compatible. But still it is pos‐
145 sible to exchange nodes from one DOM to the other. The concept of this
146 exchange is pretty similar to the function cloneNode(): The particular
147 node is copied on the lowlevel to the opposite DOM implementation.
148
149 Since the DOM implementations cannot coexist within one document, one
150 is forced to copy each node that should be used. Because you are always
151 keeping two nodes this may cause quite an impact on a machines memory
152 usage.
153
154 XML::LibXML provides two functions to export or import GDOME nodes:
155 import_GDOME() and export_GDOME(). Both function have two parameters:
156 the node and a flag for recursive import. The flag works as in cloneN‐
157 ode().
158
159 The two functions allow to export and import XML::GDOME nodes explic‐
160 itly, however, XML::LibXML allows also the transparent import of
161 XML::GDOME nodes in functions such as appendChild(), insertAfter() and
162 so on. While native nodes are automaticly adopted in most functions
163 XML::GDOME nodes are always cloned in advance. Thus if the original
164 node is modified after the operation, the node in the XML::LibXML docu‐
165 ment will not have this information.
166
167 import_GDOME
168 $libxmlnode = XML::LibXML->import_GDOME( $node, $deep );
169
170 This clones an XML::GDOME node to a XML::LibXML node explicitly.
171
172 export_GDOME
173 $gdomenode = XML::LibXML->export_GDOME( $node, $deep );
174
175 Allows to clone an XML::LibXML node into a XML::GDOME node.
176
178 Matt Sergeant, Christian Glahn, Petr Pajas,
179
181 1.62
182
184 2001-2006, AxKit.com Ltd; 2002-2006 Christian Glahn; 2006 Petr Pajas,
185 All rights reserved.
186
187
188
189perl v5.8.8 2006-11-17 LibXML(3)