home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / perl5 / XML / XPath / Node / PI.pm < prev    next >
Encoding:
Perl POD Document  |  2000-08-24  |  1.3 KB  |  82 lines

  1. # $Id: PI.pm,v 1.4 2000/08/24 16:23:02 matt Exp $
  2.  
  3. package XML::XPath::Node::PI;
  4.  
  5. use strict;
  6. use vars qw/@ISA/;
  7.  
  8. @ISA = ('XML::XPath::Node');
  9.  
  10. package XML::XPath::Node::PIImpl;
  11.  
  12. use vars qw/@ISA/;
  13. @ISA = ('XML::XPath::NodeImpl', 'XML::XPath::Node::PI');
  14. use XML::XPath::Node ':node_keys';
  15.  
  16. sub new {
  17.     my $class = shift;
  18.     my ($target, $data) = @_;
  19.     
  20.         my $pos = XML::XPath::Node->nextPos;
  21.         
  22.         my @vals;
  23.         @vals[node_global_pos, node_target, node_data] = 
  24.                 ($pos, $target, $data);
  25.     my $self = \@vals;
  26.     bless $self, $class;
  27. }
  28.  
  29. sub getNodeType { PROCESSING_INSTRUCTION_NODE }
  30.  
  31. sub isPINode { 1; }
  32. sub isProcessingInstructionNode { 1; }
  33.  
  34. sub getTarget {
  35.     my $self = shift;
  36.     $self->[node_target];
  37. }
  38.  
  39. sub getData {
  40.     my $self = shift;
  41.     $self->[node_data];
  42. }
  43.  
  44. sub _to_sax {
  45.     my $self = shift;
  46.     my ($doch, $dtdh, $enth) = @_;
  47.     # PI's not supported in PerlSAX 1
  48. }
  49.  
  50. sub string_value {
  51.     my $self = shift;
  52.     return $self->[node_data];
  53. }
  54.  
  55. sub toString {
  56.     my $self = shift;
  57.     return "<?" . $self->[node_target] . " " . XML::XPath::Node::XMLescape($self->[node_data], ">") . "?>";
  58. }
  59.  
  60. 1;
  61. __END__
  62.  
  63. =head1 NAME
  64.  
  65. PI - an XML processing instruction node
  66.  
  67. =head1 API
  68.  
  69. =head2 new ( target, data )
  70.  
  71. Create a new PI node.
  72.  
  73. =head2 getTarget
  74.  
  75. Returns the target
  76.  
  77. =head2 getData
  78.  
  79. Returns the data
  80.  
  81. =cut
  82.