[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-unattended/var/se3/unattended/install/linuxaux/opt/perl/lib/site_perl/5.10.0/XML/XPath/Node/ -> Text.pm (source)

   1  # $Id: Text.pm,v 1.5 2000/09/05 13:05:47 matt Exp $
   2  
   3  package XML::XPath::Node::Text;
   4  
   5  use strict;
   6  use vars qw/@ISA/;
   7  
   8  @ISA = ('XML::XPath::Node');
   9  
  10  package XML::XPath::Node::TextImpl;
  11  
  12  use vars qw/@ISA/;
  13  @ISA = ('XML::XPath::NodeImpl', 'XML::XPath::Node::Text');
  14  use XML::XPath::Node ':node_keys';
  15  
  16  sub new {
  17      my $class = shift;
  18      my ($text) = @_;
  19      
  20          my $pos = XML::XPath::Node->nextPos;
  21          
  22          my @vals;
  23          @vals[node_global_pos, node_text] = ($pos, $text);
  24      my $self = \@vals;
  25          
  26      bless $self, $class;
  27  }
  28  
  29  sub getNodeType { TEXT_NODE }
  30  
  31  sub isTextNode { 1; }
  32  
  33  sub appendText {
  34      my $self = shift;
  35      my ($text) = @_;
  36      $self->[node_text] .= $text;
  37  }
  38  
  39  sub getNodeValue {
  40      my $self = shift;
  41      $self->[node_text];
  42  }
  43  
  44  sub getData {
  45      my $self = shift;
  46      $self->[node_text];
  47  }
  48  
  49  sub setNodeValue {
  50      my $self = shift;
  51      $self->[node_text] = shift;
  52  }
  53  
  54  sub _to_sax {
  55      my $self = shift;
  56      my ($doch, $dtdh, $enth) = @_;
  57      
  58      $doch->characters( { Data => $self->getValue } );
  59  }
  60  
  61  sub string_value {
  62      my $self = shift;
  63      $self->[node_text];
  64  }
  65  
  66  sub toString {
  67      my $self = shift;
  68      XML::XPath::Node::XMLescape($self->[node_text], "<&");
  69  }
  70  
  71  1;
  72  __END__
  73  
  74  =head1 NAME
  75  
  76  Text - an XML text node
  77  
  78  =head1 API
  79  
  80  =head2 new ( text )
  81  
  82  Create a new text node.
  83  
  84  =head2 getValue / getData
  85  
  86  Returns the text
  87  
  88  =head2 string_value
  89  
  90  Returns the text
  91  
  92  =head2 appendText ( text )
  93  
  94  Adds the given text string to this node.
  95  
  96  =cut


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1