1Common(3) User Contributed Perl Documentation Common(3)
2
3
4
6 XML::LibXML::Common - Routines and Constants common for XML::LibXML and
7 XML::GDOME
8
10 use XML::LibXML::Common;
11
13 XML::LibXML and XML::GDOME share some of the same functionality. This
14 package should bundle some shared constansts and functions, so both
15 modules may coexist within the same scripts.
16
17 XML::LibXML::Common defines all node types as constants. While
18 XML::LibXML and XML::GDOME originally declared their own node type def‐
19 initions, one may want to use XML::LibXML::Common in its compatibility
20 mode:
21
22 * use XML::LibXML::Common qw(:libxml);
23 :libxml will use the XML::LibXML Compatibility mode, which defines
24 the old 'XML_' node-type definitions
25
26 * use XML::LibXML::Common qw(:gdome);
27 This allows one to use the XML::LibXML Compatibility mode, which
28 defines the old 'GDOME_' node-type definitions
29
30 * use XML::LibXML::Common qw(:w3c);
31 This uses the nodetype definition names as specified for DOM.
32
33 * use XML::LibXML::Common qw(:encoding);
34 This is ment if only the encoding functions of XML::LibXML::Common
35 should be used.
36
37 By default the W3 definitions as defined in the DOM specifications and
38 the encoding functions are exported by XML::LibXML::Common.
39
40 encoding functions
41
42 To encode or decode a string to or from UTF-8 XML::LibXML::Common
43 exports two functions, which use the encoding mechanism of the under‐
44 laying implementation. These functions should be used, if external
45 encoding is required (e.g. for queryfunctions).
46
47 encodeToUTF8
48
49 $encodedstring = encodeToUTF8( $name_of_encoding, $sting_to_encode );
50
51 The function will encode a string from the specified encoding to UTF-8.
52
53 decodeFromUTF8
54
55 $decodedstring = decodeFromUTF8($name_of_encoding, $string_to_decode );
56
57 This Function transforms an UTF-8 encoded string the specified encod‐
58 ing. While transforms to ISO encodings may cause errors if the given
59 stirng contains unsupported characters, both functions can transform to
60 UTF-16 encodings as well.
61
62 Note that both encoding functions report their errors on the standard
63 error. If an error occours the function will croak(). To catch the
64 error information it is required to call the encoding function from
65 within an eval block to avoid a script to stop.
66
68 Christian Glahn, (christian.glahn@uibk.ac.at) Innsbruck University
69
71 (c) 2002 Christian Glahn. All rights reserved.
72
73 This program is free software; you can redistribute it and/or modify it
74 under the same terms as Perl itself.
75
77 perl, XML::LibXML, XML::GDOME
78
79
80
81perl v5.8.8 2003-02-27 Common(3)