DTA::CAB::Format::XmlTokWrapFast - DTA::TokWrap XML, fast quick & dirty I/O for (.ddc).t.xml
##======================================================================== ## PRELIMINARIES use DTA::CAB::Format::XmlTokWrapFast; ##======================================================================== ## Constructors etc. $fmt = CLASS_OR_OBJ->new(%args); $xmlparser = $fmt->xmlparser(); ##======================================================================== ## Methods: I/O: generic $fmt = $fmt->close($savetmp=0); @layers = $fmt->iolayers(); ##======================================================================== ## Methods: I/O: Block-wise: Generic %blockOpts = $CLASS_OR_OBJECT->blockDefaults(); ##======================================================================== ## Methods: Input: Input selection $fmt = $fmt->fromString(\$string); $fmt = $fmt->fromFile($filename); $fmt = $fmt->fromFh($handle); ##======================================================================== ## Methods: Input: Generic API $doc = $fmt->parseDocument(); ##======================================================================== ## Methods: Output: MIME & HTTP stuff $short = $fmt->shortName(); $ext = $fmt->defaultExtension(); ##======================================================================== ## Methods: Output: output selection $fmt = $fmt->flush(); $str = $fmt->toString(); $fmt_or_undef = $fmt->toFile($filename_or_handle, $formatLevel); $fmt_or_undef = $fmt->toFh($fh,$formatLevel); ##======================================================================== ## Methods: Output: quick and dirty $fmt = $fmt->putDocument($doc);
DTA::CAB::Format::XmlTokWrapFast inherits from the more generic but slower DTA::CAB::Format::XmlTokWrap.
$fmt = CLASS_OR_OBJ->new(%args);
object structure: HASH ref
{ ##-- input: new doc => $doc, ##-- cached parsed DTA::CAB::Document ##-- input: inherited (but unused) #xdoc => $xdoc, ##-- XML::LibXML::Document #xprs => $xprs, ##-- override: XML::Parser parser ##-- output: inherited from DTA::CAB::Format utf8 => $bool, ##-- always true level => $level, ##-- output formatting level (default=0) output_moot => $bool, ##-- include <moot> output element? (default=1) output_ner => $bool, ##-- include <ner> output element? (default=0) }
$xmlparser = $fmt->xmlparser();
returns cached $fmt->{xprs} if available, otherwise caches & returns new XML::Parser
$fmt = $fmt->close($savetmp=0);
override calls $fmt->flush() and deletes @$fmt{qw(xdoc output)}
@layers = $fmt->iolayers();
returns PerlIO layers to use for I/O handles; override returns ':raw'
%blockOpts = $CLASS_OR_OBJECT->blockDefaults();
returns default block options as for blockOptions(); override returns as for $CLASS_OR_OBJECT->blockOptions('2m@s')
$fmt = $fmt->fromString(\$string);
input from string
$fmt = $fmt->fromFile($filename);
input from named file: override buffers XML document in $fmt->{xdoc}
$fmt = $fmt->fromFh($handle);
input from filehandle: override buffers XML document in $fmt->{xdoc}
$doc = $fmt->parseDocument();
parse document from currently selected input source; override returns buffered $fmt->{doc}.
$short = $fmt->shortName();
returns "official" short name for this format; override returns "ftxml".
$ext = $fmt->defaultExtension();
returns default filename extension for this format; override returns ".ft.xml".
$fmt = $fmt->flush();
flush accumulated output
$str = $fmt->toString(); $str = $fmt->toString($formatLevel);
flush buffered output document to byte-string
$fmt_or_undef = $fmt->toFile($filename_or_handle, $formatLevel);
flush buffered output document to $filename_or_handle; default implementation calls $fmt->toFh().
$fmt_or_undef = $fmt->toFh($fh,$formatLevel);
flush buffered output document to filehandle $fh
$fmt = $fmt->putDocument($doc);
quick and dirty output using .ddc.t.xml attributes only.
An example file in the format accepted/generated by this module is:
<?xml version="1.0" encoding="UTF-8"?> <doc> <s> <w t="wie" exlex="wie" errid="ec" msafe="1"><moot word="wie" tag="PWAV" lemma="wie"/></w> <w t="oede" msafe="0"><moot word="öde" tag="ADJD" lemma="öde"/></w> <w t="!" exlex="!" errid="ec" msafe="1"><moot word="!" tag="$." lemma="!"/></w> </s> </doc>
Bryan Jurish <moocow@cpan.org>
Copyright (C) 2011-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.
dta-cab-analyze.perl(1), dta-cab-convert.perl(1), dta-cab-http-server.perl(1), dta-cab-http-client.perl(1), dta-cab-xmlrpc-server.perl(1), dta-cab-xmlrpc-client.perl(1), DTA::CAB::Server(3pm), DTA::CAB::Client(3pm), DTA::CAB::Format(3pm), DTA::CAB(3pm), perl(1), ...
To install DTA::CAB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DTA::CAB
CPAN shell
perl -MCPAN -e shell install DTA::CAB
For more information on module installation, please visit the detailed CPAN module installation guide.