← Index
Performance Profile   « block view • line view • sub view »
For t/test-parsing
  Run on Sun Nov 14 09:49:57 2010
Reported on Sun Nov 14 09:50:07 2010

File /usr/lib/perl5/XML/LibXML/Common.pm
Statements Executed 201
Total Time 0.0022096 seconds
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
21248µs48µsXML::LibXML::Common::::bootstrapXML::LibXML::Common::bootstrap(xsub)
0000s0sXML::LibXML::Common::::BEGINXML::LibXML::Common::BEGIN
LineStmts.Exclusive
Time
Avg.Code
1#-------------------------------------------------------------------------#
2# $Id: Common.pm,v 1.5 2003/02/27 18:32:59 phish108 Exp $
3#-------------------------------------------------------------------------#
4package XML::LibXML::Common;
5
6#-------------------------------------------------------------------------#
7# global blur #
8#-------------------------------------------------------------------------#
9341µs14µsuse strict;
# spent 7µs making 1 call to strict::import
10
111800ns800nsrequire Exporter;
1218µs8µsrequire DynaLoader;
133281µs94µsuse vars qw( @ISA $VERSION @EXPORT @EXPORT_OK %EXPORT_TAGS);
# spent 74µs making 1 call to vars::import
14
15112µs12µs@ISA = qw(DynaLoader Exporter);
16
171600ns600ns$VERSION = '0.13';
18
19114µs14µsbootstrap XML::LibXML::Common $VERSION;
# spent 546µs making 1 call to DynaLoader::bootstrap
20
21#-------------------------------------------------------------------------#
22# export information #
23#-------------------------------------------------------------------------#
24132µs32µs%EXPORT_TAGS = (
25 all => [qw(
26 ELEMENT_NODE
27 ATTRIBUTE_NODE
28 TEXT_NODE
29 CDATA_SECTION_NODE
30 ENTITY_REFERENCE_NODE
31 ENTITY_NODE
32 PI_NODE
33 PROCESSING_INSTRUCTION_NODE
34 COMMENT_NODE
35 DOCUMENT_NODE
36 DOCUMENT_TYPE_NODE
37 DOCUMENT_FRAG_NODE
38 DOCUMENT_FRAGMENT_NODE
39 NOTATION_NODE
40 HTML_DOCUMENT_NODE
41 DTD_NODE
42 ELEMENT_DECLARATION
43 ATTRIBUTE_DECLARATION
44 ENTITY_DECLARATION
45 NAMESPACE_DECLARATION
46 XINCLUDE_END
47 XINCLUDE_START
48 encodeToUTF8
49 decodeFromUTF8
50 )],
51 w3c => [qw(
52 ELEMENT_NODE
53 ATTRIBUTE_NODE
54 TEXT_NODE
55 CDATA_SECTION_NODE
56 ENTITY_REFERENCE_NODE
57 ENTITY_NODE
58 PI_NODE
59 PROCESSING_INSTRUCTION_NODE
60 COMMENT_NODE
61 DOCUMENT_NODE
62 DOCUMENT_TYPE_NODE
63 DOCUMENT_FRAG_NODE
64 DOCUMENT_FRAGMENT_NODE
65 NOTATION_NODE
66 HTML_DOCUMENT_NODE
67 DTD_NODE
68 ELEMENT_DECLARATION
69 ATTRIBUTE_DECLARATION
70 ENTITY_DECLARATION
71 NAMESPACE_DECLARATION
72 XINCLUDE_END
73 XINCLUDE_START
74 )],
75 libxml => [qw(
76 XML_ELEMENT_NODE
77 XML_ATTRIBUTE_NODE
78 XML_TEXT_NODE
79 XML_CDATA_SECTION_NODE
80 XML_ENTITY_REF_NODE
81 XML_ENTITY_NODE
82 XML_PI_NODE
83 XML_COMMENT_NODE
84 XML_DOCUMENT_NODE
85 XML_DOCUMENT_TYPE_NODE
86 XML_DOCUMENT_FRAG_NODE
87 XML_NOTATION_NODE
88 XML_HTML_DOCUMENT_NODE
89 XML_DTD_NODE
90 XML_ELEMENT_DECL
91 XML_ATTRIBUTE_DECL
92 XML_ENTITY_DECL
93 XML_NAMESPACE_DECL
94 XML_XINCLUDE_END
95 XML_XINCLUDE_START
96 )],
97 gdome => [qw(
98 GDOME_ELEMENT_NODE
99 GDOME_ATTRIBUTE_NODE
100 GDOME_TEXT_NODE
101 GDOME_CDATA_SECTION_NODE
102 GDOME_ENTITY_REF_NODE
103 GDOME_ENTITY_NODE
104 GDOME_PI_NODE
105 GDOME_COMMENT_NODE
106 GDOME_DOCUMENT_NODE
107 GDOME_DOCUMENT_TYPE_NODE
108 GDOME_DOCUMENT_FRAG_NODE
109 GDOME_NOTATION_NODE
110 GDOME_HTML_DOCUMENT_NODE
111 GDOME_DTD_NODE
112 GDOME_ELEMENT_DECL
113 GDOME_ATTRIBUTE_DECL
114 GDOME_ENTITY_DECL
115 GDOME_NAMESPACE_DECL
116 GDOME_XINCLUDE_END
117 GDOME_XINCLUDE_START
118 )],
119 encoding => [qw(
120 encodeToUTF8
121 decodeFromUTF8
122 )],
123 );
124
125@EXPORT_OK = (
126 @{$EXPORT_TAGS{encoding}},
127 @{$EXPORT_TAGS{w3c}},
128 @{$EXPORT_TAGS{libxml}},
129131µs31µs @{$EXPORT_TAGS{gdome}},
130 );
131
132@EXPORT = (
133 @{$EXPORT_TAGS{encoding}},
134110µs10µs @{$EXPORT_TAGS{w3c}},
135 );
136
137#-------------------------------------------------------------------------#
138# W3 conform node types #
139#-------------------------------------------------------------------------#
140330µs10µsuse constant ELEMENT_NODE => 1;
# spent 54µs making 1 call to constant::import
141328µs9µsuse constant ATTRIBUTE_NODE => 2;
# spent 38µs making 1 call to constant::import
142324µs8µsuse constant TEXT_NODE => 3;
# spent 42µs making 1 call to constant::import
143328µs9µsuse constant CDATA_SECTION_NODE => 4;
# spent 42µs making 1 call to constant::import
144328µs9µsuse constant ENTITY_REFERENCE_NODE => 5;
# spent 43µs making 1 call to constant::import
145328µs9µsuse constant ENTITY_NODE => 6;
# spent 42µs making 1 call to constant::import
146323µs8µsuse constant PROCESSING_INSTRUCTION_NODE => 7;
# spent 45µs making 1 call to constant::import
147328µs9µsuse constant COMMENT_NODE => 8;
# spent 42µs making 1 call to constant::import
148328µs9µsuse constant DOCUMENT_NODE => 9;
# spent 41µs making 1 call to constant::import
149328µs9µsuse constant DOCUMENT_TYPE_NODE => 10;
# spent 43µs making 1 call to constant::import
150323µs8µsuse constant DOCUMENT_FRAGMENT_NODE => 11;
# spent 39µs making 1 call to constant::import
151328µs9µsuse constant NOTATION_NODE => 12;
# spent 38µs making 1 call to constant::import
152327µs9µsuse constant HTML_DOCUMENT_NODE => 13;
# spent 43µs making 1 call to constant::import
153328µs9µsuse constant DTD_NODE => 14;
# spent 44µs making 1 call to constant::import
154323µs8µsuse constant ELEMENT_DECLARATION => 15;
# spent 41µs making 1 call to constant::import
155328µs9µsuse constant ATTRIBUTE_DECLARATION => 16;
# spent 42µs making 1 call to constant::import
156326µs9µsuse constant ENTITY_DECLARATION => 17;
# spent 34µs making 1 call to constant::import
157324µs8µsuse constant NAMESPACE_DECLARATION => 18;
# spent 29µs making 1 call to constant::import
158
159#-------------------------------------------------------------------------#
160# some extras for the W3 spec
161#-------------------------------------------------------------------------#
162323µs8µsuse constant PI_NODE => 7;
# spent 37µs making 1 call to constant::import
163328µs9µsuse constant DOCUMENT_FRAG_NODE => 11;
# spent 37µs making 1 call to constant::import
164328µs9µsuse constant XINCLUDE_END => 19;
# spent 32µs making 1 call to constant::import
165329µs10µsuse constant XINCLUDE_START => 20;
# spent 42µs making 1 call to constant::import
166
167#-------------------------------------------------------------------------#
168# libxml2 compat names #
169#-------------------------------------------------------------------------#
170328µs9µsuse constant XML_ELEMENT_NODE => 1;
# spent 48µs making 1 call to constant::import
171327µs9µsuse constant XML_ATTRIBUTE_NODE => 2;
# spent 38µs making 1 call to constant::import
172328µs9µsuse constant XML_TEXT_NODE => 3;
# spent 47µs making 1 call to constant::import
173325µs8µsuse constant XML_CDATA_SECTION_NODE => 4;
# spent 40µs making 1 call to constant::import
174333µs11µsuse constant XML_ENTITY_REF_NODE => 5;
# spent 43µs making 1 call to constant::import
175328µs9µsuse constant XML_ENTITY_NODE => 6;
# spent 42µs making 1 call to constant::import
176331µs10µsuse constant XML_PI_NODE => 7;
# spent 42µs making 1 call to constant::import
177327µs9µsuse constant XML_COMMENT_NODE => 8;
# spent 47µs making 1 call to constant::import
178328µs9µsuse constant XML_DOCUMENT_NODE => 9;
# spent 37µs making 1 call to constant::import
179328µs9µsuse constant XML_DOCUMENT_TYPE_NODE => 10;
# spent 42µs making 1 call to constant::import
180328µs9µsuse constant XML_DOCUMENT_FRAG_NODE => 11;
# spent 41µs making 1 call to constant::import
181336µs12µsuse constant XML_NOTATION_NODE => 12;
# spent 61µs making 1 call to constant::import
182330µs10µsuse constant XML_HTML_DOCUMENT_NODE => 13;
# spent 44µs making 1 call to constant::import
183328µs9µsuse constant XML_DTD_NODE => 14;
# spent 38µs making 1 call to constant::import
184328µs9µsuse constant XML_ELEMENT_DECL => 15;
# spent 43µs making 1 call to constant::import
185328µs9µsuse constant XML_ATTRIBUTE_DECL => 16;
# spent 43µs making 1 call to constant::import
186328µs9µsuse constant XML_ENTITY_DECL => 17;
# spent 42µs making 1 call to constant::import
187327µs9µsuse constant XML_NAMESPACE_DECL => 18;
# spent 41µs making 1 call to constant::import
188328µs9µsuse constant XML_XINCLUDE_START => 19;
# spent 41µs making 1 call to constant::import
189339µs13µsuse constant XML_XINCLUDE_END => 20;
# spent 37µs making 1 call to constant::import
190
191#-------------------------------------------------------------------------#
192# libgdome compat names #
193#-------------------------------------------------------------------------#
194323µs8µsuse constant GDOME_ELEMENT_NODE => 1;
# spent 38µs making 1 call to constant::import
195328µs9µsuse constant GDOME_ATTRIBUTE_NODE => 2;
# spent 42µs making 1 call to constant::import
196323µs8µsuse constant GDOME_TEXT_NODE => 3;
# spent 37µs making 1 call to constant::import
197328µs9µsuse constant GDOME_CDATA_SECTION_NODE => 4;
# spent 32µs making 1 call to constant::import
198331µs10µsuse constant GDOME_ENTITY_REF_NODE => 5;
# spent 46µs making 1 call to constant::import
199327µs9µsuse constant GDOME_ENTITY_NODE => 6;
# spent 42µs making 1 call to constant::import
200328µs9µsuse constant GDOME_PI_NODE => 7;
# spent 51µs making 1 call to constant::import
201328µs9µsuse constant GDOME_COMMENT_NODE => 8;
# spent 38µs making 1 call to constant::import
202328µs9µsuse constant GDOME_DOCUMENT_NODE => 9;
# spent 41µs making 1 call to constant::import
203327µs9µsuse constant GDOME_DOCUMENT_TYPE_NODE => 10;
# spent 42µs making 1 call to constant::import
204328µs9µsuse constant GDOME_DOCUMENT_FRAG_NODE => 11;
# spent 42µs making 1 call to constant::import
205326µs9µsuse constant GDOME_NOTATION_NODE => 12;
# spent 42µs making 1 call to constant::import
206327µs9µsuse constant GDOME_HTML_DOCUMENT_NODE => 13;
# spent 42µs making 1 call to constant::import
207328µs9µsuse constant GDOME_DTD_NODE => 14;
# spent 37µs making 1 call to constant::import
208327µs9µsuse constant GDOME_ELEMENT_DECL => 15;
# spent 42µs making 1 call to constant::import
209328µs9µsuse constant GDOME_ATTRIBUTE_DECL => 16;
# spent 55µs making 1 call to constant::import
210322µs8µsuse constant GDOME_ENTITY_DECL => 17;
# spent 38µs making 1 call to constant::import
211328µs9µsuse constant GDOME_NAMESPACE_DECL => 18;
# spent 32µs making 1 call to constant::import
212327µs9µsuse constant GDOME_XINCLUDE_START => 19;
# spent 42µs making 1 call to constant::import
213360µs20µsuse constant GDOME_XINCLUDE_END => 20;
# spent 42µs making 1 call to constant::import
214
215136µs36µs1;
216#-------------------------------------------------------------------------#
217__END__
218
219=head1 NAME
220
221XML::LibXML::Common - Routines and Constants common for XML::LibXML and XML::GDOME
222
223=head1 SYNOPSIS
224
225 use XML::LibXML::Common;
226
227=head1 DESCRIPTION
228
229XML::LibXML and XML::GDOME share some of the same functionality. This
230package should bundle some shared constansts and functions, so both
231modules may coexist within the same scripts.
232
233XML::LibXML::Common defines all node types as constants. While
234XML::LibXML and XML::GDOME originally declared their own node type
235definitions, one may want to use XML::LibXML::Common in its
236compatibility mode:
237
238=over 4
239
240=item * use XML::LibXML::Common qw(:libxml);
241
242:libxml will use the XML::LibXML Compatibility mode, which defines the
243old 'XML_' node-type definitions
244
245=item * use XML::LibXML::Common qw(:gdome);
246
247This allows one to use the XML::LibXML Compatibility mode, which
248defines the old 'GDOME_' node-type definitions
249
250=item * use XML::LibXML::Common qw(:w3c);
251
252This uses the nodetype definition names as specified for DOM.
253
254=item * use XML::LibXML::Common qw(:encoding);
255
256This is ment if only the encoding functions of XML::LibXML::Common
257should be used.
258
259=back
260
261By default the W3 definitions as defined in the DOM specifications and
262the encoding functions are exported by XML::LibXML::Common.
263
264=head2 encoding functions
265
266To encode or decode a string to or from UTF-8 XML::LibXML::Common exports
267two functions, which use the encoding mechanism of the underlaying
268implementation. These functions should be used, if external encoding
269is required (e.g. for queryfunctions).
270
271=head2 encodeToUTF8
272
273 $encodedstring = encodeToUTF8( $name_of_encoding, $sting_to_encode );
274
275The function will encode a string from the specified encoding to UTF-8.
276
277=head2 decodeFromUTF8
278
279 $decodedstring = decodeFromUTF8($name_of_encoding, $string_to_decode );
280
281This Function transforms an UTF-8 encoded string the specified
282encoding. While transforms to ISO encodings may cause errors if the
283given stirng contains unsupported characters, both functions can
284transform to UTF-16 encodings as well.
285
286Note that both encoding functions report their errors on the standard
287error. If an error occours the function will croak(). To catch the
288error information it is required to call the encoding function from
289within an eval block to avoid a script to stop.
290
291=head1 AUTHOR
292
293Christian Glahn, (christian.glahn@uibk.ac.at) Innsbruck University
294
295=head1 COPYRIGHT
296
297(c) 2002 Christian Glahn. All rights reserved.
298
299This program is free software; you can redistribute it and/or modify
300it under the same terms as Perl itself.
301
302=head1 SEE ALSO
303
304L<perl>, L<XML::LibXML>, L<XML::GDOME>
305
306=cut
# spent 48µs within XML::LibXML::Common::bootstrap which was called # once (48µs+0s) by DynaLoader::bootstrap at line 219 of /usr/lib/perl/5.10/DynaLoader.pm
sub XML::LibXML::Common::bootstrap; # xsub