Krang::XML::Writer - XML::Writer sub-class with auto Base64 encoding


  use Krang::ClassLoader 'XML::Writer';
  my $writer = pkg('XML::Writer')->new();
  # ... same as XML::Writer


This module is a sub-class of XML::Writer which adds one feature. It will automatically encode XML-illegal character content as Base64 and add the !!!BASE64!!! marker. This marker is used by Krang::XML::Simple to automatically decode Base64 data.


Same as XML::Writer.


This sub-class won't work if you make multiple calls to characters() with binary data. For example:


Won't work. Instead, combine your character content into a single call:

  $writer->character("..." . "...");

Or just use the dataElement() helper function. This might be fixed someday if it becomes a problem.