1package XML::XPath::Node::PI; 2 3$VERSION = '1.44'; 4 5use strict; use warnings; 6use vars qw/@ISA/; 7 8@ISA = ('XML::XPath::Node'); 9 10package XML::XPath::Node::PIImpl; 11 12use vars qw/@ISA/; 13@ISA = ('XML::XPath::NodeImpl', 'XML::XPath::Node::PI'); 14use XML::XPath::Node ':node_keys'; 15 16sub 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 29sub getNodeType { PROCESSING_INSTRUCTION_NODE } 30 31sub isPINode { 1; } 32sub isProcessingInstructionNode { 1; } 33 34sub getTarget { 35 my $self = shift; 36 $self->[node_target]; 37} 38 39sub getData { 40 my $self = shift; 41 $self->[node_data]; 42} 43 44sub _to_sax { 45 my $self = shift; 46 my ($doch, $dtdh, $enth) = @_; 47 # PI's not supported in PerlSAX 1 48} 49 50sub string_value { 51 my $self = shift; 52 return $self->[node_data]; 53} 54 55sub toString { 56 my $self = shift; 57 return "<?" . $self->[node_target] . " " . XML::XPath::Node::XMLescape($self->[node_data], ">") . "?>"; 58} 59 601; 61__END__ 62 63=head1 NAME 64 65PI - an XML processing instruction node 66 67=head1 API 68 69=head2 new ( target, data ) 70 71Create a new PI node. 72 73=head2 getTarget 74 75Returns the target 76 77=head2 getData 78 79Returns the data 80 81=cut 82