[ANNOUNCE] XML::Filter::Glossary 0.1
by Aaron Straup Cope other posts by this author
Sep 10 2002 2:01PM messages near this date
view in the new Beta List Site
Re: [ANNOUNCE] XML::Filter::Glossary 0.1
|
Newbie question / how to install Bundle::XML?
http://search.cpan.org/author/ASCOPE/XML-Filter-Glossary-0.1
"This package is modelled after the UserLand glossary system where words,
or phrases, wrapped in double-quotes are compared against a lookup table
and are replaced by their corresponding entries.
"Currently only one type of lookup table is supported : a well-formed XBEL
bookmarks file. Support for other kinds of lookup tables may be added at a
later date.
"Keywords are flagged as being any word, or words, between double quotes
which are then looked up in the glossary. If no match is found, the text
is left unaltered.
"If a match is located, the result is then parsed with Robert Cameron's
REX shallow parsing regular expressions. Chunks of balanced markup are
then re-inserted into the SAX stream via XML::Filter::Merger. Anything
else, including markup not deemed well-formed, is added as character
data."
****
use XML::SAX::Writer;
use XML::Filter::Glossary;
use XML::SAX::ParserFactory;
my $writer = XML::SAX::Writer-> new();
my $glossary = XML::Filter::Glossary-> new(Handler=>$writer);
my $parser = XML::SAX::ParserFactory-> parser(Handler=>$glossary);
$glossary-> set_glossary("/usr/home/asc/bookmarks.xbel");
$parser-> parse_string("<?xml version = '1.0' ?><root>This is \"aaronland\"</root>");
# prints :
<?xml version = "1.0" ?>
<root>
This is <a href='http://www.aaronland.net'> aaronland</a>
</root>
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
|