DTA::CAB::Format::XmlRpc - Datum parser: XML-RPC using RPC::XML
use DTA::CAB::Format::XmlRpc;
##========================================================================
## Constructors etc.
$fmt = DTA::CAB::Format::XmlRpc->new(%args);
##========================================================================
## Methods: Input
$fmt = $fmt->close();
$fmt = $fmt->fromString($string);
$fmt = $fmt->fromFile($filename_or_handle);
$fmt = $fmt->fromFh($handle);
$fmt_or_undef = $fmt->checkData();
##========================================================================
## Methods: Output
$fmt = $fmt->flush();
$str = $fmt->toString();
$parser = $fmt->xmlParser();
$xmldoc = $fmt->rpcXmlDocument($rpcobj_or_string);
$fmt = $fmt->putToken($tok);
$fmt = $fmt->putSentence($sent);
$fmt = $fmt->putDocument($doc);
DTA::CAB::Format::XmlRpc inherits from DTA::CAB::Format::XmlCommon.
DTA::CAB::Format::XmlRpc registers the filename regex:
/\.(?i:xml-rpc|rpc[\-\.]xml)$/
with DTA::CAB::Format.
$fmt = CLASS_OR_OBJ->new(%args);
Constructor.
%args, %$fmt:
##-- input
rxprs => $rpc_parser, ##-- RPC::XML::Parser object
rxdata => $rpc_data, ##-- structured data as decoded by RPC::XML::Parser
##
##-- output
docbuf => $doc, ##-- DTA::CAB::Document output buffer
xprs => $xml_parser, ##-- XML::LibXML parser object
level => $formatLevel, ##-- format level
encoding => $encoding, ##-- output encoding
##
##-- common
#(nothing here)
@keys = $class_or_obj->noSaveKeys();
Override: returns list of keys not to be saved Here, returns qw(rxprs rxdata docbuf xprs)
.
$fmt = $fmt->close();
Override: close current input source, if any.
$fmt = $fmt->fromString($string);
Override: select input from string $string.
$fmt = $fmt->fromFile($filename_or_handle);
Override: select input from named file or handle. Calls DTA::CAB::Format::fromFile().
$fmt = $fmt->fromFh($handle);
Override: select input from filehandle.
$fmt_or_undef = $fmt->checkData();
Checks input buffer for valid parse. Called by fromWhatever()
methods.
$doc = $fmt->parseDocument();
Override: parse document from currently selected input source.
$fmt = $fmt->flush();
Override: flush accumulated output.
$str = $fmt->toString();
$str = $fmt->toString($formatLevel);
Override: flush buffered output in $fmt->{docbuf} to byte-string. Calls RPC::XML::smart_encode(), $fmt->rpcXmlDocument().
$fmt_or_undef = $fmt->toFh($fh,$formatLevel);
Override: flush buffered output to filehandle $fh.
$parser = $fmt->xmlParser();
Returns an XML::LibXML object for RPC-XML.
$xmldoc = $fmt->rpcXmlDocument($rpcobj_or_string);
Returns an XML::LibXML::Document representing its argument $rpcobj_or_string, which may be either a RPC::XML object or an XML source string.
$fmt = $fmt->putToken($tok);
$fmt = $fmt->putTokenRaw($tok);
Non-destructive / destructrive token output.
$fmt = $fmt->putSentence($sent);
$fmt = $fmt->putSentenceRaw($sent);
Non-destructive / destructive sentence output.
$fmt = $fmt->putDocument($doc);
$fmt = $fmt->putDocumentRaw($doc);
Non-destructive / destructive document output.
An example file in the format accepted/generated by this module is:
<?xml version="1.0"?>
<struct>
<member>
<name>body</name>
<value>
<array>
<data>
<value>
<struct>
<member>
<name>lang</name>
<value>
<string>de</string>
</value>
</member>
<member>
<name>tokens</name>
<value>
<array>
<data>
<value>
<struct>
<member>
<name>moot</name>
<value>
<struct>
<member>
<name>word</name>
<value>
<string>wie</string>
</value>
</member>
<member>
<name>tag</name>
<value>
<string>PWAV</string>
</value>
</member>
<member>
<name>lemma</name>
<value>
<string>wie</string>
</value>
</member>
</struct>
</value>
</member>
<member>
<name>errid</name>
<value>
<string>ec</string>
</value>
</member>
<member>
<name>hasmorph</name>
<value>
<int>1</int>
</value>
</member>
<member>
<name>lang</name>
<value>
<array>
<data>
<value>
<string>de</string>
</value>
</data>
</array>
</value>
</member>
<member>
<name>xlit</name>
<value>
<struct>
<member>
<name>latin1Text</name>
<value>
<string>wie</string>
</value>
</member>
<member>
<name>isLatinExt</name>
<value>
<int>1</int>
</value>
</member>
<member>
<name>isLatin1</name>
<value>
<int>1</int>
</value>
</member>
</struct>
</value>
</member>
<member>
<name>exlex</name>
<value>
<string>wie</string>
</value>
</member>
<member>
<name>text</name>
<value>
<string>wie</string>
</value>
</member>
<member>
<name>msafe</name>
<value>
<int>1</int>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>msafe</name>
<value>
<int>0</int>
</value>
</member>
<member>
<name>text</name>
<value>
<string>oede</string>
</value>
</member>
<member>
<name>moot</name>
<value>
<struct>
<member>
<name>lemma</name>
<value>
<string>öde</string>
</value>
</member>
<member>
<name>tag</name>
<value>
<string>ADJD</string>
</value>
</member>
<member>
<name>word</name>
<value>
<string>öde</string>
</value>
</member>
</struct>
</value>
</member>
<member>
<name>xlit</name>
<value>
<struct>
<member>
<name>latin1Text</name>
<value>
<string>oede</string>
</value>
</member>
<member>
<name>isLatin1</name>
<value>
<int>1</int>
</value>
</member>
<member>
<name>isLatinExt</name>
<value>
<int>1</int>
</value>
</member>
</struct>
</value>
</member>
</struct>
</value>
<value>
<struct>
<member>
<name>text</name>
<value>
<string>!</string>
</value>
</member>
<member>
<name>msafe</name>
<value>
<int>1</int>
</value>
</member>
<member>
<name>exlex</name>
<value>
<string>!</string>
</value>
</member>
<member>
<name>xlit</name>
<value>
<struct>
<member>
<name>isLatin1</name>
<value>
<int>1</int>
</value>
</member>
<member>
<name>isLatinExt</name>
<value>
<int>1</int>
</value>
</member>
<member>
<name>latin1Text</name>
<value>
<string>!</string>
</value>
</member>
</struct>
</value>
</member>
<member>
<name>errid</name>
<value>
<string>ec</string>
</value>
</member>
<member>
<name>moot</name>
<value>
<struct>
<member>
<name>tag</name>
<value>
<string>$.</string>
</value>
</member>
<member>
<name>lemma</name>
<value>
<string>!</string>
</value>
</member>
<member>
<name>word</name>
<value>
<string>!</string>
</value>
</member>
</struct>
</value>
</member>
</struct>
</value>
</data>
</array>
</value>
</member>
</struct>
</value>
</data>
</array>
</value>
</member>
</struct>
Bryan Jurish <moocow@cpan.org>
Copyright (C) 2009-2019 by Bryan Jurish
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.24.1 or, at your option, any later version of Perl 5 you may have available.