Re: [ANNOUNCE] XML::Filter::Glossary 0.1
by Aaron Straup Cope other posts by this author
Sep 10 2002 4:50PM messages near this date
view in the new Beta List Site
Re: [ANNOUNCE] XML::Filter::Glossary 0.1
|
[ANNOUNCE] XML::Filter::Glossary 0.1
On 10 Sep 2002, Ken MacLeod wrote:
> > "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.
>
> The UserLand glossary system is well known for catching
> false-positives -- matching words the user didn't know were in the
> glossary.
>
> One often suggested alternative is to use a glossary-namespaced XML
> element in place of the plain text and then use empty (or not??)
> glossary elements to call out glossary items:
>
> $glossary->set_glossary("/usr/home/asc/bookmarks.xbel");
> $parser->parse_string("<?xml version = '1.0' ?><root xmlns:g="http://aaronland.net/gloss
ary"> This is <g:aaronland/></root>");
I'm not opposed to adding this as an option, leaving the default as "".
From the 'thinking out loud' department:
$glossary-> set_foo({Prefix=>"g",NamespaceURI=>"..."});
sub start_element {
my $self = shift;
my $data = shift;
unless (($self-> {'__nsaware'}) &&
($data-> {Prefix} eq $self->{'__prefix'})) {
$self-> SUPER::start_element($data);
return 1;
}
# Check cache here...
# Create lookup tool here....
$self-> {'__lookup'}->set_keyword($data->{LocalName});
# Parse glossary here...
if (my $result = ...) {
$self-> parse_result($result);
return 1;
}
# how to handle no result?
$self-> SUPER::characters({Data=>$data->{LocalName}});
}
sub characters {
my $self = shift;
my $data = shift;
if ($self-> {'__nsaware'}) {
$self-> SUPER::characters($data);
return 1;
}
# ...
}
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Ken MacLeod
Bart Schuller
Aaron Straup Cope
|