XML::LibXML::Common - Routines and Constants common for XML::LibXML and XML::GDOME
SYNOPSIS
use XML::LibXML::Common;
DESCRIPTION
XML::LibXML and XML::GDOME share some of the same functionality. This
package should bundle some shared constansts and functions, so both
modules may coexist within the same scripts.
XML::LibXML::Common defines all node types as constants. While
XML::LibXML and XML::GDOME originally declared their own node type
definitions, one may want to use XML::LibXML::Common in its
compatibility mode:
* use XML::LibXML::Common qw(:libxml);
:libxml will use the XML::LibXML Compatibility mode, which defines the
old 'XML_' node-type definitions
* use XML::LibXML::Common qw(:gdome);
This allows one to use the XML::LibXML Compatibility mode, which
defines the old 'GDOME_' node-type definitions
* use XML::LibXML::Common qw(:w3c);
This uses the nodetype definition names as specified for DOM.
* use XML::LibXML::Common qw(:encoding);
This is ment if only the encoding functions of XML::LibXML::Common
should be used.
By default the W3 definitions as defined in the DOM specifications and
the encoding functions are exported by XML::LibXML::Common.
encoding functions
To encode or decode a string to or from UTF-8 XML::LibXML::Common exports
two functions, which use the encoding mechanism of the underlaying
implementation. These functions should be used, if external encoding
is required (e.g. for queryfunctions).
This Function transforms an UTF-8 encoded string the specified
encoding. While transforms to ISO encodings may cause errors if the
given stirng contains unsupported characters, both functions can
transform to UTF-16 encodings as well.
Note that both encoding functions report their errors on the standard
error. If an error occours the function will croak(). To catch the
error information it is required to call the encoding function from
within an eval block to avoid a script to stop.