RPC::XML::Parser(3) User Contributed Perl Documentation RPC::XML::Parser(3)NAME
RPC::XML::Parser - A container class for XML::Parser
SYNOPSIS
use RPC::XML::Parser;
...
$P = RPC::XML::Parser->new();
$P->parse($message);
DESCRIPTION
The RPC::XML::Parser class encapsulates the parsing process, for turning a string or an input stream into a RPC::XML::request or
RPC::XML::response object. The XML::Parser class is used internally, with a new instance created for each call to "parse" (detailed below).
This allows the RPC::XML::Parser object to be reusable, even though the XML::Parser objects are not. The methods are:
new([ARGS])
Create a new instance of the class. Any extra data passed to the constructor is taken as key/value pairs (not a hash reference) and
attached to the object.
The following parameters are currently recognized:
base64_to_fh
If passed with a true value, this tells the parser that incoming Base64 data is to be spooled to a filehandle opened onto an
anonymous temporary file. The file itself is unlinked after opening, though the resulting RPC::XML::base64 object can use its
"to_file" method to save the data to a specific file at a later point. No checks on size are made; if this option is set, all
Base64 data goes to filehandles.
base64_temp_dir
If this argument is passed, the value is taken as the directory under which the temporary files are created. This is so that
the application is not locked in to the list of directories that File::Spec defaults to with its "tmpdir" method. If this is
not passed, the previously-mentioned method is used to derive the directory in which to create the temporary files. Only
relevant if base64_to_fh is set.
parse [ { STRING | STREAM } ]
Parse the XML document specified in either a string or a stream. The stream may be any file descriptor, derivative of IO::Handle, etc.
The return value is either an object reference (to one of RPC::XML::request or RPC::XML::response) or an error string. Any non-
reference return value should be treated as an error condition.
If no argument is given, then the "parse_start" method of XML::Parser is used to create a XML::Parser::ExpatNB object, which is
returned. This object may then be used to parse the data in chunks, rather than a steady stream. See the XML::Parser manual page for
more details on how this works.
DIAGNOSTICS
The constructor returns "undef" upon failure, with the error message available in the global variable $RPC::XML::ERROR.
CAVEATS
This began as a reference implementation in which clarity of process and readability of the code took precedence over general efficiency.
It is now being maintained as production code, but may still have parts that could be written more efficiently.
BUGS
Please report any bugs or feature requests to "bug-rpc-xml at rt.cpan.org", or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=RPC-XML <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=RPC-XML>. I will be notified, and
then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
o RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=RPC-XML <http://rt.cpan.org/NoAuth/Bugs.html?Dist=RPC-XML>
o AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/RPC-XML <http://annocpan.org/dist/RPC-XML>
o CPAN Ratings
http://cpanratings.perl.org/d/RPC-XML <http://cpanratings.perl.org/d/RPC-XML>
o Search CPAN
http://search.cpan.org/dist/RPC-XML <http://search.cpan.org/dist/RPC-XML>
o Source code on GitHub
http://github.com/rjray/rpc-xml/tree/master <http://github.com/rjray/rpc-xml/tree/master>
COPYRIGHT & LICENSE
This file and the code within are copyright (c) 2009 by Randy J. Ray.
Copying and distribution are permitted under the terms of the Artistic License 2.0
(http://www.opensource.org/licenses/artistic-license-2.0.php <http://www.opensource.org/licenses/artistic-license-2.0.php>) or the GNU LGPL
2.1 (http://www.opensource.org/licenses/lgpl-2.1.php <http://www.opensource.org/licenses/lgpl-2.1.php>).
CREDITS
The XML-RPC standard is Copyright (c) 1998-2001, UserLand Software, Inc. See <http://www.xmlrpc.com> for more information about the XML-
RPC specification.
SEE ALSO
RPC::XML, RPC::XML::Client, RPC::XML::Server, XML::Parser
AUTHOR
Randy J. Ray <rjray@blackperl.com>
perl v5.12.1 2009-07-09 RPC::XML::Parser(3)