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
34 "value()":
35
36 "$s = XML::Writer::String-"new([list]);>
37 new() returns a new String handle.
38
39 "$count = $s-"print([list]);>
40 print() appends concatenated list data and returns number of items
41 in list.
42
43 "$val = $s-"value([list]);>
44 value() returns the current content of the object as a scalar. It
45 can also be used to initialize/overwrite the current content with
46 concatenated list data.
47
49 This module is designed for the specific purpose of capturing the
50 output of XML::Writer objects, as described in this document. It does
51 not inherit form IO::Handle. For an alternative solution look at
52 IO::Scalar, IO::Lines, IO::String or Tie::Handle::Scalar.
53
55 Simon Oliver <simon.oliver@umist.ac.uk>
56
58 Copyright (C) 2002 Simon Oliver
59
60 This library is free software; you can redistribute it and/or modify it
61 under the same terms as Perl itself.
62
64 XML::Writer, IO::Handle, IO::Scalar
65
66
67
68perl v5.28.0 2018-07-15 String(3)