1String(3) User Contributed Perl Documentation String(3)
2
3
4
6 XML::Writer::String - Capture output from XML::Writer.
7
9 use XML::Writer;
10 use XML::Writer::String;
11
12 my $s = XML::Writer::String->new();
13 my $writer = new XML::Writer( OUTPUT => $s );
14
15 $writer->xmlDecl();
16 $writer->startTag('root');
17 $writer->endTag();
18 $writer->end();
19
20 print $s->value();
21
23 This module implements a bare-bones class specifically for the purpose
24 of capturing data from the XML::Writer module. XML::Writer expects an
25 IO::Handle object and writes XML data to the specified object (or
26 STDOUT) via it's print() method. This module simulates such an object
27 for the specific purpose of providing the required print() method.
28
29 It is recommended that $writer->end() is called prior to calling
30 $s->value() to check for well-formedness.
31
33 XML::Writer::String provides three methods, new(), print() and value():
34
35 "$s = XML::Writer::String-"new([list]);>
36 new() returns a new String handle.
37
38 "$count = $s-"print([list]);>
39 print() appends concatenated list data and returns number of items
40 in list.
41
42 "$val = $s-"value([list]);>
43 value() returns the current content of the object as a scalar. It
44 can also be used to initialize/overwrite the current content with
45 concatenated list data.
46
48 This module is designed for the specific purpose of capturing the
49 output of XML::Writer objects, as described in this document. It does
50 not inherit form IO::Handle. For an alternative solution look at
51 IO::Scalar, IO::Lines, IO::String or Tie::Handle::Scalar.
52
54 Simon Oliver <simon.oliver@umist.ac.uk>
55
57 Copyright (C) 2002 Simon Oliver
58
59 This library is free software; you can redistribute it and/or modify it
60 under the same terms as Perl itself.
61
63 XML::Writer, IO::Handle, IO::Scalar
64
65
66
67perl v5.36.0 2023-01-20 String(3)