1Bare(3)               User Contributed Perl Documentation              Bare(3)
2
3
4

NAME

6       XML::Bare - Minimal XML parser implemented via a C state engine
7

VERSION

9       0.53
10

SYNOPSIS

12         use XML::Bare;
13
14         my $ob = new XML::Bare( text => '<xml><name>Bob</name></xml>' );
15
16         # Parse the xml into a hash tree
17         my $root = $ob->parse();
18
19         # Print the content of the name node
20         print $root->{xml}->{name}->{value};
21
22         ---
23
24         # Load xml from a file ( assume same contents as first example )
25         my $ob2 = new XML::Bare( file => 'test.xml' );
26
27         my $root2 = $ob2->parse();
28
29         $root2->{xml}->{name}->{value} = 'Tim';
30
31         # Save the changes back to the file
32         $ob2->save();
33
34         ---
35
36         # Load xml and verify against XBS ( XML Bare Schema )
37         my $xml_text = '<xml><item name=bob/></xml>''
38         my $schema_text = '<xml><item* name=[a-z]+></item*></xml>'
39         my $ob = new XML::Bare( text => $xml_text, schema => { text => $schema_text } );
40         $ob->parse(); # this will error out if schema is invalid
41

DESCRIPTION

43       This module is a 'Bare' XML parser. It is implemented in C. The parser
44       itself is a simple state engine that is less than 500 lines of C. The
45       parser builds a C struct tree from input text. That C struct tree is
46       converted to a Perl hash by a Perl function that makes basic calls back
47       to the C to go through the nodes sequentially.
48
49       The parser itself will only cease parsing if it encounters tags that
50       are not closed properly. All other inputs will parse, even invalid
51       inputs. To allowing checking for validity, a schema checker is included
52       in the module as well.
53
54       The schema format is custom and is meant to be as simple as possible.
55       It is based loosely around the way multiplicity is handled in Perl
56       regular expressions.
57
58   Supported XML
59       To demonstrate what sort of XML is supported, consider the following
60       examples. Each of the PERL statements evaluates to true.
61
62       · Node containing just text
63
64           XML: <xml>blah</xml>
65           PERL: $root->{xml}->{value} eq "blah";
66
67       · Subset nodes
68
69           XML: <xml><name>Bob</name></xml>
70           PERL: $root->{xml}->{name}->{value} eq "Bob";
71
72       · Attributes unquoted
73
74           XML: <xml><a href=index.htm>Link</a></xml>
75           PERL: $root->{xml}->{a}->{href}->{value} eq "index.htm";
76
77       · Attributes quoted
78
79           XML: <xml><a href="index.htm">Link</a></xml>
80           PERL: $root->{xml}->{a}->{href}->{value} eq "index.htm";
81
82       · CDATA nodes
83
84           XML: <xml><raw><![CDATA[some raw $~<!bad xml<>]]></raw></xml>
85           PERL: $root->{xml}->{raw}->{value} eq "some raw \$~<!bad xml<>";
86
87       · Multiple nodes; form array
88
89           XML: <xml><item>1</item><item>2</item></xml>
90           PERL: $root->{xml}->{item}->[0]->{value} eq "1";
91
92       · Forcing array creation
93
94           XML: <xml><multi_item/><item>1</item></xml>
95           PERL: $root->{xml}->{item}->[0]->{value} eq "1";
96
97       · One comment supported per node
98
99           XML: <xml><!--test--></xml>
100           PERL: $root->{xml}->{comment} eq 'test';
101
102   Schema Checking
103       Schema checking is done by providing the module with an XBS (XML::Bare
104       Schema) to check the XML against. If the XML checks as valid against
105       the schema, parsing will continue as normal. If the XML is invalid, the
106       parse function will die, providing information about the failure.
107
108       The following information is provided in the error message:
109
110       · The type of error
111
112       · Where the error occured ( line and char )
113
114       · A short snippet of the XML at the point of failure
115
116   XBS ( XML::Bare Schema ) Format
117       · Required nodes
118
119           XML: <xml></xml>
120           XBS: <xml/>
121
122       · Optional nodes - allow one
123
124           XML: <xml></xml>
125           XBS: <xml item?/>
126           or XBS: <xml><item?/></xml>
127
128       · Optional nodes - allow 0 or more
129
130           XML: <xml><item/></xml>
131           XBS: <xml item*/>
132
133       · Required nodes - allow 1 or more
134
135           XML: <xml><item/><item/></xml>
136           XBS: <xml item+/>
137
138       · Nodes - specified minimum and maximum number
139
140           XML: <xml><item/><item/></xml>
141           XBS: <xml item{1,2}/>
142           or XBS: <xml><item{1,2}/></xml>
143           or XBS: <xml><item{1,2}></item{1,2}></xml>
144
145       · Multiple acceptable node formats
146
147           XML: <xml><item type=box volume=20/><item type=line length=10/></xml>
148           XBS: <xml><item type=box volume/><item type=line length/></xml>
149
150       · Regular expressions checking for values
151
152           XML: <xml name=Bob dir=up num=10/>
153           XBS: <xml name=[A-Za-z]+ dir=up|down num=[0-9]+/>
154
155       · Require multi_ tags
156
157           XML: <xml><multi_item/></xml>
158           XBS: <xml item@/>
159
160   Parsed Hash Structure
161       The hash structure returned from XML parsing is created in a specific
162       format.  Besides as described above, the structure contains some
163       additional nodes in order to preserve information that will allow that
164       structure to be correctly converted back to XML.
165
166       Nodes may contain the following 3 additional subnodes:
167
168       · _i
169
170         The character offset within the original parsed XML of where the node
171         begins. This is used to provide line information for errors when XML
172         fails a schema check.
173
174       · _pos
175
176         This is a number indicating the ordering of nodes. It is used to
177         allow items in a perl hash to be sorted when writing back to xml.
178         Note that items are not sorted after parsing in order to save time if
179         all you are doing is reading and you do not care about the order.
180
181         In future versions of this module an option will be added to allow
182         you to sort your nodes so that you can read them in order.  ( note
183         that multiple nodes of the same name are stored in order )
184
185       · _att
186
187         This is a boolean value that exists and is 1 iff the node is an
188         attribute.
189
190   Parsing Limitations / Features
191       · CDATA parsed correctly, but stripped if unneeded
192
193         Currently the contents of a node that are CDATA are read and put into
194         the value hash, but the hash structure does not have a value
195         indicating the node contains CDATA.
196
197         When converting back to XML, the contents of the value hash are
198         parsed to check for xml incompatible data using a regular expression.
199         If 'CDATA like' stuff is encountered, the node is output as CDATA.
200
201       · Node position stored, but hash remains unsorted
202
203         The ordering of nodes is noted using the '_pos' value, but the hash
204         itself is not ordered after parsing. Currently items will be out of
205         order when looking at them in the hash.
206
207         Note that when converted back to XML, the nodes are then sorted and
208         output in the correct order to XML. Note that nodes of the same name
209         with the same parent will be grouped together; the position of the
210         first item to appear will determine the output position of the group.
211
212       · Comments are parsed but only one is stored per node.
213
214         For each node, there can be a comment within it, and that comment
215         will be saved and output back when dumping to XML.
216
217       · Comments override output of immediate value
218
219         If a node contains only a comment node and a text value, only the
220         comment node will be displayed. This is in line with treating a
221         comment node as a node and only displaying immediate values when a
222         node contains no subnodes.
223
224       · PI sections are parsed, but discarded
225
226       · Unknown "<!" sections are parsed, but discarded
227
228       · Attributes may use no quotes, single quotes, quotes, or backtics
229
230       · Quoted attributes cannot contain escaped quotes
231
232         No escape character is recognized within quotes. As a result, regular
233         quotes cannot be stored to XML, or the written XML will not be
234         correct, due to all attributes always being written using quotes.
235
236       · Attributes are always written back to XML with quotes
237
238       · Nodes cannot contain subnodes as well as an immediate value
239
240         Actually nodes can in fact contain a value as well, but that value
241         will be discarded if you write back to XML. That value is equal to
242         the first continuous string of text besides a subnode.
243
244           <node>text<subnode/>text2</node>
245           ( the value of node is text )
246
247           <node><subnode/>text</node>
248           ( the value of node is text )
249
250           <node>
251             <subnode/>text
252           </node>
253           ( the value of node is "\n  " )
254
255       · Entities are not parsed
256
257         No entity parsing is done. This is intentional. Future versions of
258         the module may include a feature to automatically parse entities, but
259         by default any such feature will be disabled in order to keep from
260         slowing down the parser.
261
262         Also, this is done so that round trip ( read and then write back out
263         ) behavior is consistent.
264
265       · Nodes named value
266
267         Previously iterations of this module had problems with nodes named
268         'value', due to the fact that node contents are stored under the
269         'value' key already.  The current version should parse such files
270         without any problem, although it may be confusing to see a parsed
271         tree with 'value' pointing to another hash containing 'value' as
272         well.
273
274         In a future version of the module it will be possible to alter the
275         name that values are stored under.
276
277         Note that node values are stored under the key 'content' when the
278         "simple" parsing mode is used, so as to be consistent with
279         XML::Simple.
280
281   Module Functions
282       · "$ob = XML::Bare->new( text => "[some xml]" )"
283
284         Create a new XML object, with the given text as the xml source.
285
286       · "$object = XML::Bare->new( file => "[filename]" )"
287
288         Create a new XML object, with the given filename/path as the xml
289         source
290
291       · "$object = XML::Bare->new( text => "[some xml]", file => "[filename]"
292         )"
293
294         Create a new XML object, with the given text as the xml input, and
295         the given filename/path as the potential output ( used by save() )
296
297       · "$object = XML::Bare->new( file => "data.xml", scheme => { file =>
298         "scheme.xbs" } )"
299
300         Create a new XML object and check to ensure it is valid xml by way of
301         the XBS scheme.
302
303       · "$tree = $object->parse()"
304
305         Parse the xml of the object and return a tree reference
306
307       · "$tree = $object->simple()"
308
309         Alternate to the parse function which generates a tree similar to
310         that generated by XML::Simple. Note that the sets of nodes are turned
311         into arrays always, regardless of whether they have a 'name'
312         attribute, unlike XML::Simple.
313
314         Note that currently the generated tree cannot be used with any of the
315         functions in this module that operate upon trees. The function is
316         provided purely as a quick and dirty way to read simple XML files.
317
318       · "$tree = xmlin( $xmlext, keeproot => 1 )"
319
320         The xmlin function is a shortcut to creating an XML::Bare object and
321         parsing it using the simple function. It behaves similarly to the
322         XML::Simple function by the same name. The keeproot option is
323         optional and if left out the root node will be discarded, same as the
324         function in XML::Simple.
325
326       · "$text = $object->xml( [root] )"
327
328         Take the hash tree in [root] and turn it into cleanly indented ( 2
329         spaces ) XML text.
330
331       · "$text = $object->html( [root], [root node name] )"
332
333         Take the hash tree in [root] and turn it into nicely colorized and
334         styled html. [root node name] is optional.
335
336       · "$object->save()"
337
338         The the current tree in the object, cleanly indent it, and save it to
339         the file parameter specified when creating the object.
340
341       · "$value = xval $node, $default"
342
343         Returns the value of $node or $default if the node does not exist.
344         If default is not passed to the function, then '' is returned as a
345         default value when the node does not exist.
346
347       · "( $name, $age ) = xget( $personnode, qw/name age/ )"
348
349         Shortcut function to grab a number of values from a node all at the
350         same time. Note that this function assumes that all of the subnodes
351         exist; it will fail if they do not.
352
353       · "$text = XML::Bare::clean( text => "[some xml]" )"
354
355         Shortcut to creating an xml object and immediately turning it into
356         clean xml text.
357
358       · "$text = XML::Bare::clean( file => "[filename]" )"
359
360         Similar to previous.
361
362       · "XML::Bare::clean( file => "[filename]", save => 1 )"
363
364         Clean up the xml in the file, saving the results back to the file
365
366       · "XML::Bare::clean( text => "[some xml]", save => "[filename]" )"
367
368         Clean up the xml provided, and save it into the specified file.
369
370       · "XML::Bare::clean( file => "[filename1]", save => "[filename2]" )"
371
372         Clean up the xml in filename1 and save the results to filename2.
373
374       · "$html = XML::Bare::tohtml( text => "[some xml]", root => 'xml' )"
375
376         Shortcut to creating an xml object and immediately turning it into
377         html.  Root is optional, and specifies the name of the root node for
378         the xml ( which defaults to 'xml' )
379
380       · "$object->add_node( [node], [nodeset name], name => value, name2 =>
381         value2, ... )"
382
383           Example:
384             $object->add_node( $root->{xml}, 'item', name => 'Bob' );
385
386           Result:
387             <xml>
388               <item>
389                 <name>Bob</name>
390               </item>
391             </xml>
392
393       · "$object->add_node_after( [node], [subnode within node to add after],
394         [nodeset name], ... )"
395
396       · "$object->del_node( [node], [nodeset name], name => value )"
397
398           Example:
399             Starting XML:
400               <xml>
401                 <a>
402                   <b>1</b>
403                 </a>
404                 <a>
405                   <b>2</b>
406                 </a>
407               </xml>
408
409             Code:
410               $xml->del_node( $root->{xml}, 'a', b=>'1' );
411
412             Ending XML:
413               <xml>
414                 <a>
415                   <b>2</b>
416                 </a>
417               </xml>
418
419       · "$object->find_node( [node], [nodeset name], name => value )"
420
421           Example:
422             Starting XML:
423               <xml>
424                 <ob>
425                   <key>1</key>
426                   <val>a</val>
427                 </ob>
428                 <ob>
429                   <key>2</key>
430                   <val>b</val>
431                 </ob>
432               </xml>
433
434             Code:
435               $object->find_node( $root->{xml}, 'ob', key => '1' )->{val}->{value} = 'test';
436
437             Ending XML:
438               <xml>
439                 <ob>
440                   <key>1</key>
441                   <val>test</val>
442                 </ob>
443                 <ob>
444                   <key>2</key>
445                   <val>b</val>
446                 </ob>
447               </xml>
448
449       · "$object->find_by_perl( [nodeset], "[perl code]" )"
450
451         find_by_perl evaluates some perl code for each node in a set of
452         nodes, and returns the nodes where the perl code evaluates as true.
453         In order to easily reference node values, node values can be directly
454         referred to from within the perl code by the name of the node with a
455         dash(-) in front of the name. See the example below.
456
457         Note that this function returns an array reference as opposed to a
458         single node unlike the find_node function.
459
460           Example:
461             Starting XML:
462               <xml>
463                 <ob>
464                   <key>1</key>
465                   <val>a</val>
466                 </ob>
467                 <ob>
468                   <key>2</key>
469                   <val>b</val>
470                 </ob>
471               </xml>
472
473             Code:
474               $object->find_by_perl( $root->{xml}->{ob}, "-key eq '1'" )->[0]->{val}->{value} = 'test';
475
476             Ending XML:
477               <xml>
478                 <ob>
479                   <key>1</key>
480                   <val>test</val>
481                 </ob>
482                 <ob>
483                   <key>2</key>
484                   <val>b</val>
485                 </ob>
486               </xml>
487
488       · "XML::Bare::merge( [nodeset1], [nodeset2], [id node name] )"
489
490         Merges the nodes from nodeset2 into nodeset1, matching the contents
491         of each node based up the content in the id node.
492
493         Example:
494
495           Code:
496             my $ob1 = new XML::Bare( text => "
497               <xml>
498                 <multi_a/>
499                 <a>bob</a>
500                 <a>
501                   <id>1</id>
502                   <color>blue</color>
503                 </a>
504               </xml>" );
505             my $ob2 = new XML::Bare( text => "
506               <xml>
507                 <multi_a/>
508                 <a>john</a>
509                 <a>
510                   <id>1</id>
511                   <name>bob</name>
512                   <bob>1</bob>
513                 </a>
514               </xml>" );
515             my $root1 = $ob1->parse();
516             my $root2 = $ob2->parse();
517             merge( $root1->{'xml'}->{'a'}, $root2->{'xml'}->{'a'}, 'id' );
518             print $ob1->xml( $root1 );
519
520           Output:
521             <xml>
522               <multi_a></multi_a>
523               <a>bob</a>
524               <a>
525                 <id>1</id>
526                 <color>blue</color>
527                 <name>bob</name>
528                 <bob>1</bob>
529               </a>
530             </xml>
531
532       · "XML::Bare::del_by_perl( ... )"
533
534         Works exactly like find_by_perl, but deletes whatever matches.
535
536       · "XML::Bare::forcearray( [noderef] )"
537
538         Turns the node reference into an array reference, whether that node
539         is just a single node, or is already an array reference.
540
541       · "XML::Bare::new_node( ... )"
542
543         Creates a new node...
544
545       · "XML::Bare::newhash( ... )"
546
547         Creates a new hash with the specified value.
548
549       · "XML::Bare::simplify( [noderef] )"
550
551         Take a node with children that have immediate values and creates a
552         hashref to reference those values by the name of each child.
553
554       · "XML::Bare::hash2xml( [hashref] )"
555
556         Take a recursive hash tree ( perhaps generated by the simplify
557         function ) and turn it into a raw XML string. Note that this function
558         does not indent nicely. You will need to feed this string back into
559         the parser and output it again if you want it to look nice. ( or you
560         could use the 'clean' function to do it in one go )
561
562       · "XML::Bare->new( text => "[xml]", unsafe => 1 )"
563
564         An extra speedy way to parse XML. It is unsafe; may harm pets and
565         children. Don't say you weren't warned. 30% speed boost compared to
566         the normal parsing. You -must- use $ob->simple() in combination with
567         this for it to work properly.
568
569         The speed boost is gained by skipping checks for the end of the
570         string when in the middle of properly formatted XML. The only time
571         the check is done is within "values" ( which includes the space after
572         the final closing </xml> )
573
574         Also, in the unsafe mode, tags, complete with their attributes, must
575         be on one line.  Node contents of course, can still have carriage
576         returns...
577
578       · "$object->read_more( text => "[xml fragment]" )"
579
580         Add more XML text to be handled. Note that this function must be
581         called before calling the parse function.
582
583         Example:
584
585           Code:
586             my $ob = XML::Bare->new( text => "
587               <xml>
588                 <node>a</node>" );
589             $ob->read_more( text => "<node>b</node>" );
590             $ob->read_more( text => "</xml>" );
591             my $root = $ob->parse();
592             print $ob->xml( $root );
593
594           Output:
595             <xml>
596               <node>a</node>
597               <node>b</node>
598             </xml>
599
600         Warning! Reading in additional XML fragments only works properly at
601         proper "division points".  Currently the parser will -not- work
602         properly if you split in the middle of a node value, or in the middle
603         of a node name. A future version of the module will be properly
604         updated to handle these cases.
605
606         Currently there is little to no benefit to parsing this way, rather
607         than simple concatenating the two strings together and then reading
608         all the XML in at once.
609
610   Functions Used Internally
611       · "check() checkone() readxbs() free_tree_c()"
612
613       · "lineinfo() c_parse() c_parse_unsafely() c_parse_more() c_parsefile()
614         free_tree() xml2obj()"
615
616       · "obj2xml() get_root() obj2html() xml2obj_simple()"
617
618   Controversy
619       Since the creation of this module there has been a fair amount of
620       controvesy surrounding it. A number of authors of other XML parsers
621       have gone so far as to publicly attack this module and claim that it
622       'does not parse XML', and 'it is not XML compliant'. Some of the same
623       people seem to be angered by the inclusion of a benchmark, claiming
624       that it is an unfair comparison, and that if the proper options and
625       setup are used, that other XML parsers are better.
626
627       The module should parse any XML document that conforms to the
628       standardized XML specifications, there is no need for alarm and fear
629       that the module will corrupt your XML documents on reading.
630
631       To be blunt about how the parser works, very little has been done to
632       make the parser follow the specification known as 'XML'. The parser is
633       meant to be flexibile and somewhat resilient, and will parse XML like
634       garbage that would cause other parsers to error out.
635
636       As far as I am concerned, as the author of the module, the 'XML' in
637       'XML::Bare' should be thought of to mean 'eXtremely Mad Language',
638       because the module was written from scratch without referring to the
639       specification known as 'XML'.
640
641       In regard to the complaints about the unfairness of the included
642       benchmarks, please make your own intelligent decision as to what module
643       you like by trying multiple modules and/or running the performance
644       tests yourself. If you like some other module, use that module. If you
645       like XML::Bare and think it is the fastest thing on the planet, that is
646       cool too.
647
648       If you hate XML::Bare and want to go around on the internet trashing it
649       and telling people to use something else, I think perhaps you may want
650       to seek counseling.
651
652   Performance
653       In comparison to other available perl xml parsers that create trees,
654       XML::Bare is extremely fast. In order to measure the performance of
655       loading and parsing compared to the alternatives, a templated speed
656       comparison mechanism has been created and included with XML::Bare.
657
658       The include makebench.pl file runs when you make the module and creates
659       perl files within the bench directory corresponding to the .tmpl
660       contained there.
661
662       Currently there are three types of modules that can be tested against,
663       executable parsers ( exe.tmpl ), tree parsers ( tree.tmpl ), and
664       parsers that do not generated trees ( notree.tmpl ).
665
666       A full list of modules currently tested against is as follows:
667
668         EzXML (exe)
669         Tiny XML (exe)
670         XML::Descent (notree)
671         XML::DOM
672         XML::Fast
673         XML::Grove::Builder
674         XML::Handler::Trees
675         XMLIO (exe)
676         XML::LibXML (notree)
677         XML::LibXML::Simple
678         XML::Parser (notree)
679         XML::Parser::EasyTree
680         XML::Parser::Expat (notree)
681         XML::SAX::Simple
682         XML::Simple using XML::Parser
683         XML::Simple using XML::SAX::PurePerl
684         XML::Simple using XML::LibXML::SAX::Parser
685         XML::Simple using XML::Bare::SAX::Parser
686         XML::Smart
687         XML::Twig
688         XML::TreePP
689         XML::Trivial
690         XML::XPath::XMLParser
691
692       To run the comparisons, run the appropriate perl file within the bench
693       directory. ( exe.pl, tree.pl, or notree.pl )
694
695       The script measures the milliseconds of loading and parsing, and
696       compares the time against the time of XML::Bare. So a 7 means it takes
697       7 times as long as XML::Bare.
698
699       Here is a combined table of the script run against each alternative
700       using the included test.xml:
701
702         -Module-                   load     parse    total
703         XML::Bare                  1        1        1
704         XML::TreePP                2.3063   33.1776  6.1598
705         XML::Parser::EasyTree      4.9405   25.7278  7.4571
706         XML::Handler::Trees        7.2303   26.5688  9.6447
707         XML::Trivial               5.0636   12.4715  7.3046
708         XML::Smart                 6.8138   78.7939  15.8296
709         XML::Simple (XML::Parser)  2.3346   50.4772  10.7455
710         XML::Simple (PurePerl)     2.361    261.4571 33.6524
711         XML::Simple (LibXML)       2.3187   163.7501 23.1816
712         XML::Simple (XML::Bare)    2.3252   59.1254  10.9163
713         XML::SAX::Simple           8.7792   170.7313 28.3634
714         XML::Twig                  27.8266  56.4476  31.3594
715         XML::Grove::Builder        7.1267   26.1672  9.4064
716         XML::XPath::XMLParser      9.7783   35.5486  13.0002
717         XML::LibXML (notree)       11.0038  4.5758   10.6881
718         XML::Parser (notree)       4.4698   17.6448  5.8609
719         XML::Parser::Expat(notree) 3.7681   50.0382  6.0069
720         XML::Descent (notree)      6.0525   37.0265  11.0322
721         Tiny XML (exe)                               1.0095
722         EzXML (exe)                                  1.1284
723         XMLIO (exe)                                  1.0165
724
725       Here is a combined table of the script run against each alternative
726       using the included feed2.xml:
727
728         -Module-                   load     parse    total
729         XML::Bare                  1        1        1
730         XML::Bare (simple)         1        0.7238   ?
731         XML::Bare (unsafe simple)  1       ~0.5538   ?
732         XML::Fast                  1.516    0.9733   1.4783
733         XML::TreePP                0.6393   30.5951  2.6874
734         XML::MyXML                 1.8266   14.2571  2.7113
735         XML::Parser::EasyTree      1.5208   22.8283  2.9748
736         XML::Trivial               2.007    25.742   3.615
737         XML::Tiny                  0.1665   61.4918  4.3234
738         XML::XPath::XMLParser      2.5762   33.2567  4.6742
739         XML::Smart                 1.702    59.4907  5.7566
740         XML::Simple (XML::Parser)  0.5838   64.7243  5.0006
741         XML::DOM::Lite             4.5207   17.4617  5.4033
742         XML::Simple (LibXML)       0.5904   161.7544 11.5731
743         XML::Twig                  8.553    56.9034  11.8805
744         XML::Grove::Builder        7.2021   30.7926  12.9334
745         XML::Handler::Trees        6.8545   33.1007  13.0575
746         XML::LibXML::Simple        14.0204  11.8482  13.8707
747         XML::Simple (PurePerl)     0.6176   321.3422 23.0465
748         XML::Simple                2.7168   90.7203  26.7525
749         XML::SAX::Simple           8.7386   94.8276  29.2166
750         XML::LibXML (notree)       11.0023  5.022    10.5214
751         XML::Parser (notree)       4.3748   25.0213  5.9803
752         XML::Parser::Expat(notree) 3.6555   51.6426  7.4316
753         XML::Descent (notree)      5.9206   155.0289 18.7767
754         Tiny XML (exe)                               1.2212
755         EzXML (exe)                                  1.3618
756         XMLIO (exe)                                  1.0145
757
758       These results show that XML::Bare is, at least on the test machine,
759       running all tests within cygwin, faster at loading and parsing than
760       everything being tested against.
761
762       The following things are shown as well:
763         - XML::Bare can parse XML and create a hash tree
764         in less time than it takes LibXML just to parse.
765         - XML::Bare can parse XML and create a tree
766         in less time than all three binary parsers take
767         just to parse.
768         - XML::Fast is theoretically faster at parsing than
769         the default 'full' mode of XML::Bare. Despite that,
770         the 'simple' mode of XML::Bare is even faster.
771
772       Note that the executable parsers are not perl modules and are timed
773       using dummy programs that just uses the library to load and parse the
774       example files. The executables are not included with this program. Any
775       source modifications used to generate the shown test results can be
776       found in the bench/src directory of the distribution
777

LICENSE

779         Copyright (C) 2008 David Helkowski
780
781         This program is free software; you can redistribute it and/or
782         modify it under the terms of the GNU General Public License as
783         published by the Free Software Foundation; either version 2 of the
784         License, or (at your option) any later version.  You may also can
785         redistribute it and/or modify it under the terms of the Perl
786         Artistic License.
787
788         This program is distributed in the hope that it will be useful,
789         but WITHOUT ANY WARRANTY; without even the implied warranty of
790         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
791         GNU General Public License for more details.
792
793
794
795perl v5.32.0                      2020-07-28                           Bare(3)
Impressum