NAME

DTA::CAB::Format::XmlRpc - Datum parser: XML-RPC using RPC::XML

SYNOPSIS

 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);
 

DESCRIPTION

Globals

Variable: @ISA

DTA::CAB::Format::XmlRpc inherits from DTA::CAB::Format::XmlCommon.

Filenames

DTA::CAB::Format::XmlRpc registers the filename regex:

 /\.(?i:xml-rpc|rpc[\-\.]xml)$/

with DTA::CAB::Format.

Constructors etc.

new
 $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)

Methods: Persistence

noSaveKeys
 @keys = $class_or_obj->noSaveKeys();

Override: returns list of keys not to be saved Here, returns qw(rxprs rxdata docbuf xprs).

Methods: Input

close
 $fmt = $fmt->close();

Override: close current input source, if any.

fromString
 $fmt = $fmt->fromString($string);

Override: select input from string $string.

fromFile
 $fmt = $fmt->fromFile($filename_or_handle);

Override: select input from named file or handle. Calls DTA::CAB::Format::fromFile().

fromFh
 $fmt = $fmt->fromFh($handle);

Override: select input from filehandle.

checkData
 $fmt_or_undef = $fmt->checkData();

Checks input buffer for valid parse. Called by fromWhatever() methods.

parseDocument
 $doc = $fmt->parseDocument();

Override: parse document from currently selected input source.

Methods: Output

flush
 $fmt = $fmt->flush();

Override: flush accumulated output.

toString
 $str = $fmt->toString();
 $str = $fmt->toString($formatLevel);

Override: flush buffered output in $fmt->{docbuf} to byte-string. Calls RPC::XML::smart_encode(), $fmt->rpcXmlDocument().

toFh
 $fmt_or_undef = $fmt->toFh($fh,$formatLevel);

Override: flush buffered output to filehandle $fh.

xmlParser
 $parser = $fmt->xmlParser();

Returns an XML::LibXML object for RPC-XML.

rpcXmlDocument
 $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.

putToken
putTokenRaw
 $fmt = $fmt->putToken($tok);
 $fmt = $fmt->putTokenRaw($tok);

Non-destructive / destructrive token output.

putSentence
putSentenceRaw
 $fmt = $fmt->putSentence($sent);
 $fmt = $fmt->putSentenceRaw($sent);

Non-destructive / destructive sentence output.

putDocument
putDocumentRaw
 $fmt = $fmt->putDocument($doc);
 $fmt = $fmt->putDocumentRaw($doc);

Non-destructive / destructive document output.

EXAMPLE

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>&#xF6;de</string>
                                   </value>
                                 </member>
                                 <member>
                                   <name>tag</name>
                                   <value>
                                     <string>ADJD</string>
                                   </value>
                                 </member>
                                 <member>
                                   <name>word</name>
                                   <value>
                                     <string>&#xF6;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>

AUTHOR

Bryan Jurish <moocow@cpan.org>

COPYRIGHT AND LICENSE

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.