NAME
DTA::CAB::Format::XmlTokWrapFast - DTA::TokWrap XML, fast quick & dirty I/O for (.ddc).t.xml
SYNOPSIS
##========================================================================
## PRELIMINARIES
##========================================================================
## 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
);
DESCRIPTION
Globals
- Variable: @ISA
-
DTA::CAB::Format::XmlTokWrapFast inherits from the more generic but slower DTA::CAB::Format::XmlTokWrap.
Constructors etc.
- new
-
$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
-
$xmlparser
=
$fmt
->xmlparser();
returns cached $fmt->{xprs} if available, otherwise caches & returns new XML::Parser
Methods: I/O: generic
- close
-
$fmt
=
$fmt
->
close
(
$savetmp
=0);
override calls $fmt->flush() and deletes @$fmt{qw(xdoc output)}
- iolayers
-
@layers
=
$fmt
->iolayers();
returns PerlIO layers to use for I/O handles; override returns ':raw'
Methods: I/O: Block-wise: Generic
- blockDefaults
-
%blockOpts
=
$CLASS_OR_OBJECT
->blockDefaults();
returns default block options as for blockOptions(); override returns as for $CLASS_OR_OBJECT->blockOptions('2m@s')
Methods: Input: Input selection
- fromString
-
$fmt
=
$fmt
->fromString(\
$string
);
input from string
- fromFile
-
$fmt
=
$fmt
->fromFile(
$filename
);
input from named file: override buffers XML document in $fmt->{xdoc}
- fromFh
-
$fmt
=
$fmt
->fromFh(
$handle
);
input from filehandle: override buffers XML document in $fmt->{xdoc}
Methods: Input: Generic API
- parseDocument
-
$doc
=
$fmt
->parseDocument();
parse document from currently selected input source; override returns buffered $fmt->{doc}.
Methods: Output: MIME & HTTP stuff
- shortName
-
$short
=
$fmt
->shortName();
returns "official" short name for this format; override returns "ftxml".
- defaultExtension
-
$ext
=
$fmt
->defaultExtension();
returns default filename extension for this format; override returns ".ft.xml".
Methods: Output: output selection
- flush
-
$fmt
=
$fmt
->flush();
flush accumulated output
- toString
-
$str
=
$fmt
->toString();
$str
=
$fmt
->toString(
$formatLevel
);
flush buffered output document to byte-string
- toFile
-
$fmt_or_undef
=
$fmt
->toFile(
$filename_or_handle
,
$formatLevel
);
flush buffered output document to $filename_or_handle; default implementation calls $fmt->toFh().
- toFh
-
$fmt_or_undef
=
$fmt
->toFh(
$fh
,
$formatLevel
);
flush buffered output document to filehandle $fh
Methods: Output: quick and dirty
- putDocument
-
$fmt
=
$fmt
->putDocument(
$doc
);
quick and dirty output using .ddc.t.xml attributes only.
EXAMPLE
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>
AUTHOR
Bryan Jurish <moocow@cpan.org>
COPYRIGHT AND LICENSE
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.
SEE ALSO
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), ...