XML-Twig

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

  not have to deal with them (suggestion from Philippe Verdret)

- fixed: bug in the navigation XPath engine: text() was used instead of 
  string(). Both are now allowed.

- added: XML::Twig::Elt sort_children, sort_children_on_value, 
  sort_children_on_att and sort_children_on_field methods that sort the
  children of an element in place

- added:XML::Twig::Elt field_to_att and att_to_field methods

- fixed:a memory leak due to ids not being weak references

- added: the XML::Twig::Elt wrap_children method that wraps children
  of an element that satisfy a regexp in a new element

- added: the XML::Twig::Elt add_id method that adds an id to an element
  
- added: the XML::Twig::Elt strip_add method that deletes an attribute
  from an element and its descendants

- COMPATIBILITY WARNING
  fixed:a quasi-bug in set_att where the hash passed in reference was
  used directly, which makes it a problem when the same reference is
  passed several times: all the elements share the same attributes.
  This is a potentially incompatible change for code that relied on 
  this feature. Please report problems to the author.

- fixed: bug in set_id

- fixed: bug spotted by Bill Gunter: allowed _ as the initial character 
  for XML names. Also now allow ':' as the first element

- added: the simplify methods, which load a twig into an XML::Simple like 
  data structure

- fixed: bug in get_type and is_elt, spotted and fixed by Paul Stodghill

- added: the XML::Twig::Elt ancestors_or_self method

- fixed: bug when doc root is also a twig_root (twig was not built)

- improved: the README (fleshed out examples, added OS X to the list of 
  tested platforms)

- fixed: bug when using the no_dtd_output option

- added: doc for the XML::Twig::Elt children_count method

- added: the XML::Twig::Elt children_text method

- improved: updated the doc so it can be properly formatted by my custom pod2html,
  the generated doc (with a bigger ToC and better links) is available
  from the XML::Twig page at http://xmltwig.com/xmltwig/
  
  
3.09 - 2002-11-10 

- added: XML::Twig::Elt xml_text method

- fixed: several bugs in the split method under 5.8.0 when matching a utf8
  character (thanks to Dominic Mitchell who spotted them)

- improved: cleaned-up the pod (still in progress)

- added: the XML::Twig::Elt pos method that gives the position of
  an element in its parent's child list

- fixed: re-introduced parseurl (thanks to Denis Kolokol for spotting its 
  absence in this version)

- fixed: ent_tag_handlers were not called on the root (thanks
  to Philippe Verdret

- improved: #PI (also declared as '?') and #COMMENT handler support 

- added: check on reference type (must be XML::Twig::Elt) in 
  XML::Twig::Elt::paste (patch by Forrest Cahoon)


3.08 - 2002-09-17 

- fixed: the previous fix wasn't enough :--( 

3.07 - 2002-09-17 

- fixed:the way weaken is imported from Scalar::Util

3.06 - 2002-09-17 

- added: XML::Twig::Elt trimmed_text and related methods (trimmed_field,
  first_child_trimmed_text, last_child_trimmed_text...)

- added: XML::Twig::Elt replace_with method

- added: XML::Twig::Elt cut_children method

- added: XML::Twig contains_only method

- added: *[att=~ /regexp/] condition type (suggested by Nikola Janceski)

- fixed: bug in the way handlers for gi, path and subpath were chained
  (Thanks to Tommy Wareing)

- fixed: bug where entities caused an error on other handlers (Thanks
  to Tommy Wareing)

- fixed: bug with string(sub_elt)=~ /regexp/ (thanks to Tommy Wareing)

- fixed: bug with output_filter used with expand_external_entities
  (thanks to Tommy Wareing)

- fixed: (yet another!) bug with whitespace handling (whitespace, then an
  entity made the whitespace move after the entity) (spotted by the usual
  Tommy Wareing)

- added: an error message when pasting on an undef reference (suggestion
  of Tommy Wareing)

- fixed: bug in in_context (found by Tommy Wareing)

Changes  view on Meta::CPAN


  Note that KeepEncoding is a global setting, if you use several twigs,
  some with KeepEncoding and some without then you will have to manually
  set the option using the set_keep_encoding method, otherwise the last
  XML::Twig::new call will have set it

  In addition when the KeepEncoding option is used the start tag is
  parsed using a custom function parse_start_tag, which works only
  for 1-byte encodings (it is regexp-based). This method can be 
  overridden using the ParseStartTag (or parse_start_tag) option
  when creating the twig. This function takes the original string as
  input and returns the gi and the attributes (in a hash).
  If you write a function that works for multi-byte encodings I would
  very much appreciate if you could send it back to me so I can add it
  to the module, so other users can benefit from it.

  An additional option ExpansExternalEnts will expand external entity
  references to their text (in the output, the text stored is &ent;).

- added: when handlers (twig_handlers or start_tag_handlers) are called
  $_ is set to the element node, so quick hacks look better:
  
      my $t= new XML::Twig( twig_handlers => 
            { elt => sub { print $_->att( 'id'), ": ", $_->text, "\n"; } }
	                    );

- added: XML::Twig dispose method which properly reclaims all the memory
  used by the object (useful if you don't have WeakRef installed)

- added: XML::Twig and XML::Twig::Elt ignore methods, which can be called
  from a start_tag_handlers handler and cause the element (or the
  current element if called on a twig) to be ignored by the 
  parsing

- added: XML::Twig parse_start_tag option that overrides the default function
  used to parse start tags when KeepEncoding is used

- added: XML::Twig::Elt xml_string, pcdata_xml_string and att_xml_string
  all return an XML-escaped string for an element (including 
  sub-elements and their tags but not the enclosing tags for the 
  element), a #PCDATA element and an attribute

- added: XML::Twig::Elt methods tag and set_tag, equivalent respectively
  to gi and set_gi
  
- added: XML::Twig and XML::Twig::Elt set_keep_encoding methods can be used
  to set the keep_encoding value if you use several twigs with 
  different keep_encoding options

- improved: option names for XML::Twig::new are now checked (a warning is output
  if the option is not a valid one);

- improved: when using pretty_print nice or indented keep_spaces_in is now checked
  so the elements within an element listed in keep_spaces_in are not
  indented

- added: XML::Twig::Elt insert_new_elt method that does a new and a paste

- added: XML::Twig::Elt split_at method splits a #PCDATA element in 2

- added: XML::Twig::Elt split method splits all the text descendants of an 
   element, on a regep, wrapping text captured in brackets in the
   regexp in a specified element, all elements are returned 

- added: XML::Twig::Elt mark method is similar to the split method, except
  that only newly created elements (matched by the regexp) are
  returned

- added: XML::Twig::Elt get_type method returns #ELT for elements and the gi
  (#PCDATA, #CDATA...) otherwise

- added: XML::Twig::Elt is_elt returns the gi if the element is a real element
  and 0 if it is #PCDATA, #CDATA...
  
- added: XML::Twig::Elt contains_only_text returns 1 if the element contains no
  "real" element (is_field is another name for it)

- added: First implementation of the output_filter option which filters the
  text before it is output by the print, sprint, flush and text methods
  (only works for print at the moment, and still under test with various
  versions of XML::Parser). Standard filters are also available

  Example:
   
      #!/bin/perl -w
      use strict;
      use XML::Twig;

      my $t = new XML::Twig(output_filter => 'latin1');
      $t->parse( \*DATA);
      $t->print;
 
      __DATA__
      <?xml version="1.0" encoding="ISO-8859-1"?>
         <docù atté="valuè">Un homme soupçonné d'être impliqué dans 
           la mort d'un motard de la police, renversé
         </docù>

  The 'latin1', 'html' and 'safe' filters are predefined, you can also
  build additional filters using Iconv (requires text::Iconv) and 
  Unicode::String (requires Unicode::String and Unicode::Map8):

      my $conv = XML::Twig::iconv_convert( 'latin1');
      my $t = new XML::Twig(output_filter => $conv);

      my $conv = XML::Twig::unicode_convert( 'latin1');
      my $t = new XML::Twig(output_filter => $conv);

  warning: conversions work fine with XML::Parser 2.27 but sometimes fail
  with XML::Parser 2.30 (on Perl 5.6.1, Linux 2.4 on a PC) when using 
  'latin1' without Text::Iconv or Unicode::String and Unicode::Map8
  installed.

  The input_filter option works the same way, except the text is 
  converted before it is stored in the twig (so you can use regexp in 
  your native encoding for example) 

- added: the XML::Twig::Elt set_asis method sets a property of an element that
  causes it to be output asis (without XML-escaping < " and &) so you
  can still create tagged text

- added: the XML::Twig::Elt prefix and suffix methods accept an optional
  'asis' argument that causes the prefix or suffix to get the asis
  property (so you can do $elt->prefix( '<b>foo</b>', 'asis') for
  example)



( run in 2.145 seconds using v1.01-cache-2.11-cpan-71847e10f99 )