=head1 NAME

XmlValue - A Perl interface to the DbXml XmlValue Class

=head1 SYNOPSIS

    use Sleepycat::DbXml;

    my $v = new XmlValue()
    my $v = new XmlValue(VALUE);
    my $v = new XmlValue(TYPE, VALUE);

    my $type = $v->getType([$context]);

    my $boolean  = $v->isNull;
    my $boolean  = $v->isBoolean([$context]);
    my $boolean  = $v->isNumber([$context]);
    my $boolean  = $v->isString([$context]);
    my $boolean  = $v->isDocument([$context]);
    my $boolean  = $v->isVariable([$context]);
    my $boolean  = $v->isNode([$context]);

    my $boolean  = $v->asBoolean([$context]);
    my $number   = $v->asNumber([$context]);
    my $string   = $v->asString([$context]);
    my $document = $v->asDocument([$context]);

    $v->equals($v2, [$context]);



=head1 DESCRIPTION



=head1 CONFORMANCE to C++ API

The Perl interface to XMlValue is identical to the C++ API, apart from
the following

=over 5

=item 1.

No Perl interface is provided to the asNodeList or asAttribute methods.

=item 2.

In the C++ API, most of the methods in this class take a mandatory
XmlQueryContext parameter. In the Perl interface this parameter is
optional.

=back


=head1 Constructor

The constructor for XmlValue can take one of the following three forms:

    my $value = new XmlValue() ;
    my $value = new XmlValue(VALUE);
    my $value = new XmlValue(TYPE, VALUE);

The first form, with no parameters, will create an empty XmlValue.

The second, with one parameter, creates and initialises an XmlValue of
type XmlValue::STRING.

The third form creates and initialises an XmlValue of the specified type.

The TYPE parameter can be one of the following

    XmlValue::NONE
    XmlValue::STRING
    XmlValue::NUMBER
    XmlValue::BOOLEAN
    XmlValue::DOCUMENT
    XmlValue::NODE
    XmlValue::VARIABLE
    XmlValue::BINARY

The VALUE parameter is the value you want stored in the XmlValue object.


=head1 Methods

=head2 my $type = $v->getType([$context])

Returns the numeric representation of the type of the XmlValue. The
value returned will match one of the following constants:

    XmlValue::NONE
    XmlValue::STRING
    XmlValue::NUMBER
    XmlValue::BOOLEAN
    XmlValue::DOCUMENT
    XmlValue::NODE
    XmlValue::VARIABLE
    XmlValue::BINARY

The $context parameter is optional, but if present must be a valid
XmlQueryContext object.

=head2 my $boolean = $v->isNull

Returns true if $v is null, otherwize returns false.

=head2 my $boolean  = $v->isBoolean([$context])

Returns true if $v has type XmlValue::BOOLEAN, otherwise returns false.

The $context parameter is optional, but if present must be a valid
XmlQueryContext object.

=head2 my $boolean  = $v->isNumber([$context]);

Returns true if $v has type XmlValue::NUMBER, otherwise returns false.

The $context parameter is optional, but if present must be a valid
XmlQueryContext object.

=head2 my $boolean  = $v->isString([$context]);

Returns true if $v has type XmlValue::STRING, otherwise returns false.

The $context parameter is optional, but if present must be a valid
XmlQueryContext object.

=head2 my $boolean  = $v->isDocument([$context]);

Returns true if $v has type XmlValue::DOCUMENT, otherwise returns false.

The $context parameter is optional, but if present must be a valid
XmlQueryContext object.

=head2 my $boolean  = $v->isVariable([$context]);

Returns true if $v has type XmlValue::VARIABLE, otherwise returns false.

The $context parameter is optional, but if present must be a valid
XmlQueryContext object.

=head2 my $boolean  = $v->isNode([$context]);

Returns true if $v has type XmlValue::NODE, otherwise returns false.

The $context parameter is optional, but if present must be a valid
XmlQueryContext object.

=head2 my $boolean  = $v->asBoolean([$context]);

Returns the value of the XmlValue as a Boolean. 

The $context parameter is optional, but if present must be a valid
XmlQueryContext object.


=head2 my $number   = $v->asNumber([$context]);

Returns the value of the XmlValue as a Number.

The $context parameter is optional, but if present must be a valid
XmlQueryContext object.

=head2 my $string   = $v->asString([$context]);

Returns the value of the XmlValue as a String.

The $context parameter is optional, but if present must be a valid
XmlQueryContext object.

=head2 my $document = $v->asDocument([$context]);

Returns the value of the XmlValue as a Document.

The $context parameter is optional, but if present must be a valid
XmlQueryContext object.

=head2 $v->equals($v2, [$context]);

The $context parameter is optional, but if present must be a valid
XmlQueryContext object.


=head1 EXAMPLES

    use strict;
    use warnings;

    use DbXml;

    # Create an empty object
    my $value1 = new XmlValue ;

    # Create and initialise a string
    my $value2 = new XmlValue("alpha");

    # Create and initialise another string
    my $value3 = new XmlValue(XmlValue::STRING, "beta");

    # Create and initialise a number
    my $value4 = new XmlValue(XmlValue::NUMBER, 42);

    print "value2 contains " . $value2->asString() . "\n" ;

    print "value4 is a Number\n"
        if $value4->getType == XmlValue::NUMBER ;
    

=head1 NOTES



=head1 SEE ALSO


=head1 AUTHOR

Paul Marquess
