The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Tree::Persist::File::XMLWithSingleQuotes - A handler for Tree persistence

SYNOPSIS

See "SYNOPSIS" in Tree::Persist or scripts/xml.demo.pl for sample code.

DESCRIPTION

This module is a plugin for Tree::Persist to store a Tree to an XML file.

This module uses single-quotes around the values of tag attributes.

PARAMETERS

Parameters are used in the call to "connect({%opts})" in Tree::Persist or "create_datastore({%opts})" in Tree::Persist.

In addition to any parameters required by its parent Tree::Persist::File, the following parameters are used by connect() or create_datastore():

  • class (optional)

    This is the name of the deflator/inflator class.

    The class parameter takes precedence over the type parameter.

    If class is not provided, type is used, and defaults to 'File'. Then class is determined using:

            $class = $type eq 'File' ? 'Tree::Persist::File::XML' : 'Tree::Persist::DB::SelfReferential';

    See t/save_and_load.t for sample code.

METHODS

Tree::Persist::File::XMLWithSingleQuotes is a sub-class of Tree::Persist::File, and inherits all its methods.

XML SPEC

The XML used is very simple. Each element is called "node". The node contains two attributes - "class", which represents the Tree class to build this node for, and "value", which is the serialized value contained in the node (as retrieved by the value() method.) Parent-child relationships are represented by the parent containing the child.

NOTE: This plugin will currently only handle values that are strings or have a stringification method.

The 5 build-in XML character entities (within the value of the node) are encoded using this map:

        my(%encode) = ('<' => '&lt;', '>' => '&gt;', '&' => '&amp;', "'" => '&apos;', '"' => '&quot;');

They are decoded when XML::Parser reads the value back in.

See http://www.w3.org/standards/xml/core for details.

See t/save_and_load.t for sample code.

CODE COVERAGE

Please see the relevant section of Tree::Persist.

SUPPORT

Please see the relevant section of Tree::Persist.

AUTHORS

Rob Kinyon <rob.kinyon@iinteractive.com>

Stevan Little <stevan.little@iinteractive.com>

Thanks to Infinity Interactive for generously donating our time.

Co-maintenance since V 1.01 is by Ron Savage <rsavage@cpan.org>. Uses of 'I' in previous versions is not me, but will be hereafter.

COPYRIGHT AND LICENSE

Copyright 2004, 2005 by Infinity Interactive, Inc.

http://www.iinteractive.com

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.