XML::SAX::RTF
XML::SAX::RTF - SAX Driver for Microsoft's Rich Text Format (RTF)
SYNOPSIS
use
XML::SAX::RTF;
my
$handler
= new MyHandler;
my
$parser
= XML::SAX::ParserFactory->parser(
Handler
=>
$handler
);
$parser
->parse_file(
shift
@ARGV
);
package
MyHandler;
sub
new {
my
$class
=
shift
;
my
$self
= {
@_
};
return
bless
(
$self
,
$class
);
}
sub
start_element {
my
(
$self
,
$data
) =
@_
;
"<"
,
$data
->{Name};
if
(
exists
(
$data
->{Attributes} )) {
my
%atts
= %{
$data
->{Attributes}};
foreach
my
$att
(
keys
%atts
) {
my
$val
=
$atts
{
$att
};
$val
=~ s/\"/
"
;/g;
" $att=\"$val\""
;
}
}
">"
;
}
sub
end_element {
my
(
$self
,
$data
) =
@_
;
"</"
,
$data
->{Name},
">"
;
}
sub
characters {
my
(
$self
,
$data
) =
@_
;
$data
->{Data};
}
DESCRIPTION
This is a subclass of XML::SAX::Base which implements a SAX driver for RTF documentation. It generates XML that closely matches the structure of RTF, i.e. a set of paragraph types with text and inline tags inside.
AUTHOR
Erik Ray (eray@oreilly.com)
MAINTAINER NEEDED
The original author seems to have abandoned this module. If you find the module useful, please consider adopting it. Contact grantm@cpan.org for co-maintainer access.
COPYRIGHT
Copyright 2002 Erik Ray and O'Reilly & Associates Inc.