1=head1 NAME 2 3XML::LibXML::PI - XML::LibXML Processing Instructions 4 5=head1 SYNOPSIS 6 7 use XML::LibXML; 8 # Only methods specific to Processing Instruction nodes listed here, 9 # see XML::LibXML::Node manpage for other methods 10 11 $pinode->setData( $data_string ); 12 $pinode->setData( name=>string_value [...] ); 13 14 15=head1 DESCRIPTION 16 17Processing instructions are implemented with XML::LibXML with read and write 18access. The PI data is the PI without the PI target (as specified in XML 1.0 19[17]) as a string. This string can be accessed with getData as implemented in 20XML::LibXML::Node. 21 22The write access is aware about the fact, that many processing instructions 23have attribute like data. Therefore setData() provides besides the DOM spec 24conform Interface to pass a set of named parameter. So the code segment 25 26 my $pi = $dom->createProcessingInstruction("abc"); 27 $pi->setData(foo=>'bar', foobar=>'foobar'); 28 $dom->appendChild( $pi ); 29 30will result the following PI in the DOM: 31 32 <?abc foo="bar" foobar="foobar"?> 33 34Which is how it is specified in the DOM specification. This three step 35interface creates temporary a node in perl space. This can be avoided while 36using the insertProcessingInstruction() method. Instead of the three calls 37described above, the call 38 39 $dom->insertProcessingInstruction("abc",'foo="bar" foobar="foobar"'); 40 41will have the same result as above. 42 43XML::LibXML::PI's implementation of setData() differs a bit from the the 44standard version as available in XML::LibXML::Node(): 45 46=over 4 47 48=item B<setData> 49 50 $pinode->setData( $data_string ); 51 $pinode->setData( name=>string_value [...] ); 52 53This method allows to change the content data of a PI. Additionally to the 54interface specified for DOM Level2, the method provides a named parameter 55interface to set the data. This parameter list is converted into a string 56before it is appended to the PI. 57 58 59 60=back 61 62=head1 AUTHORS 63 64Matt Sergeant, 65Christian Glahn, 66Petr Pajas, 67 68=head1 VERSION 69 701.64 71 72=head1 COPYRIGHT 73 742001-2007, AxKit.com Ltd; 2002-2006 Christian Glahn; 2006-2007 Petr Pajas, All rights reserved. 75 76=cut 77