XML::LibXML - Perl Binding for libxml2
$Version_String = XML::LibXML::LIBXML_DOTTED_VERSION; $Version_ID = XML::LibXML::LIBXML_VERSION; $DLL_Version = XML::LibXML::LIBXML_RUNTIME_VERSION; $libxmlnode = XML::LibXML->import_GDOME( $node, $deep ); $gdomenode = XML::LibXML->export_GDOME( $node, $deep );
use XML::LibXML; my $parser = XML::LibXML->new();
my $doc = $parser->parse_string(<<'EOT'); <some-xml/> EOT
For further information, please check the following documentation:
$Version_String = XML::LibXML::LIBXML_DOTTED_VERSION;
Returns the version string of the libxml2 version XML::LibXML was compiled for. This will be ``2.6.2'' for ``libxml2 2.6.2''.
$Version_ID = XML::LibXML::LIBXML_VERSION;
Returns the version id of the libxml2 version XML::LibXML was compiled for. This will be ``20602'' for ``libxml2 2.6.2''. Don't mix this version id with $XML::LibXML::VERSION. The latter contains the version of XML::LibXML itself while the first contains the version of libxml2 XML::LibXML was compiled for.
$DLL_Version = XML::LibXML::LIBXML_RUNTIME_VERSION;
Returns a version string of the libxml2 which is (usually dynamically) linked by XML::LibXML. This will be ``20602'' for libxml2 released as ``2.6.2'' and something like ``20602-CVS2032'' for a CVS build of libxml2.
XML::LibXML issues a warning if the version of libxml2 dynamically linked to it is less than the version of libxml2 which it was compiled against.
Although both modules make use of libxml2's XML capabilities, the DOM implementation of both modules are not compatible. But still it is possible to exchange nodes from one DOM to the other. The concept of this exchange is pretty similar to the function cloneNode(): The particular node is copied on the low-level to the opposite DOM implementation.
Since the DOM implementations cannot coexist within one document, one is forced to copy each node that should be used. Because you are always keeping two nodes this may cause quite an impact on a machines memory usage.
XML::LibXML provides two functions to export or import GDOME nodes: import_GDOME() and export_GDOME(). Both function have two parameters: the node and a flag for recursive import. The flag works as in cloneNode().
The two functions allow to export and import XML::GDOME nodes explicitly, however, XML::LibXML allows also the transparent import of XML::GDOME nodes in functions such as appendChild(), insertAfter() and so on. While native nodes are automatically adopted in most functions XML::GDOME nodes are always cloned in advance. Thus if the original node is modified after the operation, the node in the XML::LibXML document will not have this information.
$libxmlnode = XML::LibXML->import_GDOME( $node, $deep );
This clones an XML::GDOME node to a XML::LibXML node explicitly.
$gdomenode = XML::LibXML->export_GDOME( $node, $deep );
Allows to clone an XML::LibXML node into a XML::GDOME node.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |