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         $pinode->setData( $data_string );
10         $pinode->setData( name=>string_value [...] );
11

DESCRIPTION

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

AUTHORS

53       Matt Sergeant, Christian Glahn, Petr Pajas,
54

VERSION

56       1.62
57
59       2001-2006, AxKit.com Ltd; 2002-2006 Christian Glahn; 2006 Petr Pajas,
60       All rights reserved.
61
62
63
64perl v5.8.8                       2006-11-17                XML::LibXML::PI(3)
Impressum