1XML::LibXML::PI(3)    User Contributed Perl Documentation   XML::LibXML::PI(3)
2
3
4

NAME

6       XML::LibXML::PI - XML::LibXML Processing Instructions
7

SYNOPSIS

9         use XML::LibXML;
10         # Only methods specific to Processing Instruction nodes are listed here,
11         # see XML::LibXML::Node manpage for other methods
12
13         $pinode->setData( $data_string );
14         $pinode->setData( name=>string_value [...] );
15

DESCRIPTION

17       Processing instructions are implemented with XML::LibXML with read and
18       write access. The PI data is the PI without the PI target (as specified
19       in XML 1.0 [17]) as a string. This string can be accessed with getData
20       as implemented in XML::LibXML::Node.
21
22       The write access is aware about the fact, that many processing
23       instructions have attribute like data. Therefore setData() provides
24       besides the DOM spec conform Interface to pass a set of named
25       parameter. So the code segment
26
27         my $pi = $dom->createProcessingInstruction("abc");
28         $pi->setData(foo=>'bar', foobar=>'foobar');
29         $dom->appendChild( $pi );
30
31       will result the following PI in the DOM:
32
33         <?abc foo="bar" foobar="foobar"?>
34
35       Which is how it is specified in the DOM specification. This three step
36       interface creates temporary a node in perl space. This can be avoided
37       while using the insertProcessingInstruction() method. Instead of the
38       three calls described above, the call
39
40         $dom->insertProcessingInstruction("abc",'foo="bar" foobar="foobar"');
41
42       will have the same result as above.
43
44       XML::LibXML::PI's implementation of setData() documented below differs
45       a bit from the the standard version as available in XML::LibXML::Node:
46
47       setData
48             $pinode->setData( $data_string );
49             $pinode->setData( name=>string_value [...] );
50
51           This method allows to change the content data of a PI. Additionally
52           to the interface specified for DOM Level2, the method provides a
53           named parameter interface to set the data. This parameter list is
54           converted into a string before it is appended to the PI.
55

AUTHORS

57       Matt Sergeant, Christian Glahn, Petr Pajas
58

VERSION

60       1.70
61
63       2001-2007, AxKit.com Ltd.
64
65       2002-2006, Christian Glahn.
66
67       2006-2009, Petr Pajas.
68
69
70
71perl v5.12.0                      2009-10-07                XML::LibXML::PI(3)
Impressum