<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"># $Id: Text.pm 7909 2004-08-06 05:11:55Z mdewsnip $

package XML::XPath::Node::Text;

use strict;
use vars qw/@ISA/;

@ISA = ('XML::XPath::Node');

package XML::XPath::Node::TextImpl;

use vars qw/@ISA/;
@ISA = ('XML::XPath::NodeImpl', 'XML::XPath::Node::Text');
use XML::XPath::Node ':node_keys';

sub new {
    my $class = shift;
    my ($text) = @_;
    
        my $pos = XML::XPath::Node-&gt;nextPos;
        
        my @vals;
        @vals[node_global_pos, node_text] = ($pos, $text);
    my $self = \@vals;
        
    bless $self, $class;
}

sub getNodeType { TEXT_NODE }

sub isTextNode { 1; }

sub appendText {
    my $self = shift;
    my ($text) = @_;
    $self-&gt;[node_text] .= $text;
}

sub getNodeValue {
    my $self = shift;
    $self-&gt;[node_text];
}

sub getData {
    my $self = shift;
    $self-&gt;[node_text];
}

sub setNodeValue {
    my $self = shift;
    $self-&gt;[node_text] = shift;
}

sub _to_sax {
    my $self = shift;
    my ($doch, $dtdh, $enth) = @_;
    
    $doch-&gt;characters( { Data =&gt; $self-&gt;getValue } );
}

sub string_value {
    my $self = shift;
    $self-&gt;[node_text];
}

sub toString {
    my $self = shift;
    XML::XPath::Node::XMLescape($self-&gt;[node_text], "&lt;&amp;");
}

1;
__END__

=head1 NAME

Text - an XML text node

=head1 API

=head2 new ( text )

Create a new text node.

=head2 getValue / getData

Returns the text

=head2 string_value

Returns the text

=head2 appendText ( text )

Adds the given text string to this node.

=cut
</pre></body></html>