This queue is for tickets about the XML-Twig CPAN distribution.

Report information
The Basics
Id:
25836
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
dsteinbrunner [...] pobox.com
Cc:
AdminCc:

BugTracker
Severity:
Normal
Broken in:
3.28
Fixed in:
  • 3.30
  • 3.31
  • 3.32



Subject: Typo in docs
In the first paragraph for the new method of XML::Twig::Elt the word "reference" is shown as "refreference".
From: MIROD@cpan.org
On Mon Mar 26 21:56:53 2007, dsteinbrunner@pobox.com wrote:
Show quoted text
> In the first paragraph for the new method of XML::Twig::Elt the word > "reference" is shown as > "refreference".
Thanks, I have fixed it in the devlopment version and will be in the next release. __ mirod
From: dsteinbrunner@pobox.com
On Mon Mar 26 23:55:31 2007, MIROD wrote:
Show quoted text
> On Mon Mar 26 21:56:53 2007, dsteinbrunner@pobox.com wrote:
> > In the first paragraph for the new method of XML::Twig::Elt the word > > "reference" is shown as > > "refreference".
> > Thanks, I have fixed it in the devlopment version and will be in the > next release.
I ended up finding a few more so I decided to run a spell check on the perldoc and create a patch. The patch excludes the issue above. I noticed the use of some British English words and left those as is but may have changed some others unknowingly so please be sure that all the corrections are actually correct.
--- Twig copy.pm 2007-03-26 22:27:43.000000000 -0400 +++ Twig.pm 2007-03-27 00:50:46.000000000 -0400 @@ -286,7 +286,7 @@ Default => \&_twig_print_original, ); -# handlers used whithin ignored elements +# handlers used within ignored elements my %twig_handlers_ignore= ( Start => \&_twig_ignore_start, End => \&_twig_ignore_end, @@ -1214,7 +1214,7 @@ sub _join_n { return join( "\n", @_, ''); } # input: the predicate ($_[0]) which will be changed in place -# flags, a hasref with various flags (like test_on_text) +# flags, a hashref with various flags (like test_on_text) # the score sub _parse_predicate_in_handler { my( $flag, $score)= @_[1..2]; @@ -1225,7 +1225,7 @@ |([><]=?|=|!=)(?=\s*[\d+-]) # test before a number |([><]=?|=|!=) # test, other cases |($REG_FUNCTION) # no arg functions - # this bit is a mess, but its the only solution whith this half-baked parser + # this bit is a mess, but its the only solution with this half-baked parser |(string\(\s*$REG_NAME\s*\)\s*$REG_MATCH\s*$REG_REGEXP) # string( child)=~ /regexp/ |(string\(\s*$REG_NAME\s*\)\s*!?=\s*$REG_VALUE) # string( child) = "value" (or !=) |(string\(\s*$REG_NAME\s*\)\s*[<>]=?\s*$REG_VALUE) # string( child) > "value" @@ -4614,7 +4614,7 @@ |([><]=?|=|!=)(?=\s*[\d+-]) # test before a number |([><]=?|=|!=) # test, other cases |($REG_FUNCTION) # no arg functions - # this bit is a mess, but its the only solution whith this half-baked parser + # this bit is a mess, but its the only solution with this half-baked parser |((?:string|text)\(\s*$REG_NAME\s*\)\s*$REG_MATCH\s*$REG_REGEXP) # string( child) =~ /regexp/ |((?:string|text)\(\s*$REG_NAME\s*\)\s*!?=\s*$REG_VALUE) # string( child) = "value" (or !=) |((?:string|text)\(\s*$REG_NAME\s*\)\s*[<>]=?\s*$REG_VALUE) # string( child) > "value" @@ -5475,7 +5475,7 @@ my @descendants=(); my $elt= $subtree_root; - # this branch is pure optimisation for speed: if $cond is a gi replace it + # this branch is pure optimization for speed: if $cond is a gi replace it # by the index of the gi and loop here # start optimization my $ind; @@ -8471,7 +8471,7 @@ =item XML::Twig only works with XML::Parser 2.27 in perl 5.6.* -Note that I can't compile XML::Parser 2.27 anymore, so I can't garantee +Note that I can't compile XML::Parser 2.27 anymore, so I can't guarantee that it still works =item XML::Parser 2.28 does not really work @@ -8550,7 +8550,7 @@ Attributes are just attached to their parent element, they are not objects per se. (Please use the provided methods C<L<att>> and C<L<set_att>> to access them, if you access them -as a hash, then your code becomes implementaion dependant and might break in the future). +as a hash, then your code becomes implementation dependent and might break in the future). Other classes that are seldom used are C<L<XML::Twig::Entity_list>> and C<L<XML::Twig::Entity>>. @@ -8646,14 +8646,14 @@ Finally C<_all_> handlers are triggered last. B<Important>: once a handler has been triggered if it returns 0 then no other -handler is called, exept a C<_all_> handler which will be called anyway. +handler is called, except a C<_all_> handler which will be called anyway. If a handler returns a true value and other handlers apply, then the next -applicable handler will be called. Repeat, rince, lather..; The exception +applicable handler will be called. Repeat, rinse, lather..; The exception to that rule is when the C<L<do_not_chain_handlers|do_not_chain_handlers>> option is set, in which case only the first handler will be called. -Note that it might be a good idea to explicitely return a short true value +Note that it might be a good idea to explicitly return a short true value (like 1) from handlers: this ensures that other applicable handlers are called even if the last statement for the handler happens to evaluate to false. This might also speedup the code by avoiding the result of the last @@ -8829,7 +8829,7 @@ If this option is set to a true value, then only one handler will be called for each element, even if several satisfy the condition -Note that the C<_all_> handler will still be called regardeless +Note that the C<_all_> handler will still be called regardless =item ignore_elts @@ -8874,7 +8874,7 @@ a C<Tie::IxHash> object. This means that C<Tie::IxHash> needs to be installed for this option to be available. It also means that the hash keeps its order, so you will get -the attributes in order. This allows outputing the attributes in the same +the attributes in order. This allows outputting the attributes in the same order as they were in the original document. =item keep_encoding @@ -8925,7 +8925,7 @@ =item html does the same conversion as C<latin1>, plus encodes entities using -C<HTML::Entities> (oddly enough you will need to have HTML::Entities intalled +C<HTML::Entities> (oddly enough you will need to have HTML::Entities installed for it to be available). This should only be used if the tags and attribute names themselves are in US-ASCII, or they will be converted and the output will not be valid XML any more @@ -9030,7 +9030,7 @@ When this option is used external entities (that are defined) are expanded when the document is output using "print" functions such as C<L<print> >, C<L<sprint|sprint> >, C<L<flush|flush> > and C<L<xml_string|xml_string> >. -Note that in the twig the entity will be stored as an element whith a +Note that in the twig the entity will be stored as an element with a tag 'C<#ENT>', the entity will not be expanded there, so you might want to process the entities before outputting it. @@ -9158,7 +9158,7 @@ =item indented_c Same as C<indented> but a little more compact: the closing tags are on the -same line as the preceeding text +same line as the preceding text =item wrapped @@ -9229,7 +9229,7 @@ You can use C<< $elt->first_child( 'tag') >> (which is a good habit anyway) to get where you want. -Consider using C<process> if you are outputing SAX events from XML::Twig. +Consider using C<process> if you are outputting SAX events from XML::Twig. =back @@ -9283,7 +9283,7 @@ =item keep_original_prefix When used with C<L<map_xmlns>> this option will make C<XML::Twig> use the original -namespace prefixes when outputing a document. The mapped prefix will still be used +namespace prefixes when outputting a document. The mapped prefix will still be used for triggering handlers and in navigation and query methods. my $t= XML::Twig->new( map_xmlns => {'http://www.w3.org/2000/svg' => "svg"}, @@ -9715,7 +9715,7 @@ =item trim -Trim the document: gets rid of initial and trailing spaces, and relace multiple spaces +Trim the document: gets rid of initial and trailing spaces, and replaces multiple spaces by a single one. =item toSAX1 ($handler) @@ -9738,7 +9738,7 @@ =item ignore -This method hould be called during parsing, usually in C<start_tag_handlers>. +This method should be called during parsing, usually in C<start_tag_handlers>. It causes the element to be skipped during the parsing: the twig is not built for this element, it will not be accessible during parsing or after it. The element will not take up any memory and parsing will be faster. @@ -9984,7 +9984,7 @@ =item findvalue ( $optional_array_ref, $xpath, $optional_offset) -Return the C<join> of all texts of the results of appling C<L<get_xpath>> +Return the C<join> of all texts of the results of applying C<L<get_xpath>> to the node (similar to the XML::LibXML method) =item subs_text ($regexp, $replace) @@ -10040,7 +10040,7 @@ B<WARNING>: if you rely on ID's then you will have to set the id yourself. At this point the element does not belong to a twig yet, so the ID attribute -is not known so it won't be strored in the ID list. +is not known so it won't be stored in the ID list. Note that C<#COMMENT>, C<#PCDATA> or C<#CDATA> are valid tag names, that will create text elements. @@ -10213,7 +10213,7 @@ =item set_field ($condition, $optional_atts, @list_of_elt_and_strings) Set the content of the first child of the element that matches -C<$condition>, the rest of the arguments is tha same as for C<L<set_content>> +C<$condition>, the rest of the arguments is the same as for C<L<set_content>> If no child matches C<$condition> _and_ if C<$condition> is a valid XML element name, then a new element by that name is created and @@ -10255,12 +10255,12 @@ =item is_first_child ($optional_condition) returns true (the element) if the element is the first child of its parent -(optionaly that satisfies the C<$optional_condition>) +(optionally that satisfies the C<$optional_condition>) =item is_last_child ($optional_condition) returns true (the element) if the element is the first child of its parent -(optionaly that satisfies the C<$optional_condition>) +(optionally that satisfies the C<$optional_condition>) =item prev_sibling ($optional_condition) @@ -10372,7 +10372,7 @@ =item ancestors ($optional_condition) Return the list of ancestors (optionally matching C<$optional_condition>) of the -element. The list is ordered from the innermost ancestor to the outtermost one +element. The list is ordered from the innermost ancestor to the outermost one NOTE: the element itself is not part of the list, in order to include it you will have to use ancestors_or_self @@ -10381,7 +10381,7 @@ Return the list of ancestors (optionally matching C<$optional_condition>) of the element, including the element (if it matches the condition>). -The list is ordered from the innermost ancestor to the outtermost one +The list is ordered from the innermost ancestor to the outermost one =item passes ($condition) @@ -10789,7 +10789,7 @@ subs_text does text substitution, similar to perl's C< s///> operator. -C<$regexp> must be a perl regexp, created with the C<qr> operatot. +C<$regexp> must be a perl regexp, created with the C<qr> operator. C<$replace> can include C<$1, $2>... from the C<$regexp>. It can also be used to create element and entities, by using @@ -10905,7 +10905,7 @@ =item field_to_att ($cond, $att) Turn the text of the first sub-element matched by C<$cond> into the value of -attribute C<$att> of the element. If C<$att> is ommited then C<$cond> is used +attribute C<$att> of the element. If C<$att> is omitted then C<$cond> is used as the name of the attribute, which makes sense only if C<$cond> is a valid element (and attribute) name. @@ -10914,7 +10914,7 @@ =item att_to_field ($att, $tag) Take the value of attribute C<$att> and create a sub-element C<$tag> as first -child of the element. If C<$tag> is ommited then C<$att> is used as the name of +child of the element. If C<$tag> is omitted then C<$att> is used as the name of the sub-element. @@ -11058,7 +11058,7 @@ C<< $elt->wrap_in( 'td', 'tr', 'table') >> wraps the element as a single cell in a table for example. -Optionally each tag can be followed by a hasref of attributes, that will be +Optionally each tag can be followed by a hashref of attributes, that will be set on the wrapping element: $elt->wrap_in( p => { class => "advisory" }, div => { class => "intro", id => "div_intro }); @@ -11091,7 +11091,7 @@ B<WARNING>: if you rely on ID's then you will have to set the id yourself. At this point the element does not belong to a twig yet, so the ID attribute -is not known so it won't be strored in the ID list. +is not known so it won't be stored in the ID list. A content of 'C<#EMPTY>' creates an empty element; @@ -11110,7 +11110,7 @@ =item current_ns_prefixes -Returna list of namespace prefixes valid for the element. The order of the +Return a list of namespace prefixes valid for the element. The order of the prefixes in the list has no meaning. If the default namespace is currently bound, '' appears in the list. @@ -11217,7 +11217,7 @@ escaped by the print functions: if it contains C<< a < b >> it will be output as such and not as C<< a &lt; b >>. This can be useful to create text elements that will be output as markup. Note that all C<PCDATA> descendants of the -element are also marked as having the property (they are the ones taht are +element are also marked as having the property (they are the ones that are actually impacted by the change). If the element is a C<CDATA> element it will also be output asis, without the @@ -11233,7 +11233,7 @@ =item closed -Return true if the element has been closed. Might be usefull if you are +Return true if the element has been closed. Might be useful if you are somewhere in the tree, during the parse, and have no idea whether a parent element is completely loaded or not. @@ -11394,12 +11394,12 @@ =item prev_siblings ($optional_condition) -Return the list of previous siblings (optionaly matching C<$optional_condition>) +Return the list of previous siblings (optionally matching C<$optional_condition>) for the element. The elements are ordered in document order. =item next_siblings ($optional_condition) -Return the list of siblings (optionaly matching C<$optional_condition>) +Return the list of siblings (optionally matching C<$optional_condition>) following the element. The elements are ordered in document order. =item pos ($optional_condition) @@ -12027,7 +12027,7 @@ Basically you can read the DTD, output it back properly, and update entities, but not much more. -So use XML::Twig with standalone documents, or with documents refering to an +So use XML::Twig with standalone documents, or with documents referring to an external DTD, but don't expect it to properly parse and even output back the DTD. @@ -12144,7 +12144,7 @@ saving some space when creating a twig. If they really cause you too much trouble, let me know, it is probably possible to create either a switch or at least a version of XML::Twig that -does not perform this optimisation. +does not perform this optimization. %gi2index; # tag => index @index2gi; # list of tags @@ -12158,7 +12158,7 @@ =item global_state -Return a hasref with all the global variables used by XML::Twig +Return a hashref with all the global variables used by XML::Twig The hash has the following fields: C<pretty>, C<quote>, C<indent>, C<empty_tag_style>, C<keep_encoding>, C<expand_external_entities>, @@ -12256,7 +12256,7 @@ the output for example. As it does not stick to the DOM, is also usually leads to shorter code than in XML::LibXML. -Beyond the pure features of the 2 modules, XML::LibXML seems to be prefered by +Beyond the pure features of the 2 modules, XML::LibXML seems to be preferred by "XML-purists", while XML::Twig seems to be more used by Perl Hackers who have to deal with XML. As you have noted, XML::Twig also comes with quite a lot of docs, but I am sure if you ask for help about XML::LibXML here or on Perlmonks @@ -12272,7 +12272,7 @@ while I haven't looked much into XML::LibXML so it still looks shinny and clean to me. -That said, ifyou need to process a document that is too big to fit memory +That said, if you need to process a document that is too big to fit memory and XML::Twig is too slow for you, my reluctant advice would be to use "bare" XML::Parser. It won't be as easy to use as XML::Twig: basically with XML::Twig you trade some speed (depending on what you do from a factor 3 to... none)


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.