NAME
XTM::Smile::SAX - AsTMa tag expansion
SYNOPSIS
use XTM::Smile::SAX;
my $expander = new XTM::Smile::SAX (tmbase => 'file:/where/are/the/maps/');
my $parser = find a SAX parser here (Handler => $expander);
$parser->parse_string($XML);
DESCRIPTION
This package scans the SAX event stream for tags in the namespace
http://topicmaps.bond.edu.au/astma/1.0/
and expands them into tags of the namespace
http://topicmaps.bond.edu.au/smile/1.0/
according to the description below.
Example:
<?xml ....
<some_document>
...
<astma:default astma:tau_expr="file:w3o.atm"/>
<astma:slide astma:tid="w3c-user-interface"/>
...
</some_document>
will consult the man I<file:w3o.atm> and will return
<?xml ....
<some_document>
...
<smile:slide smile:tid='w3c-user-interface'>
<smile:title>User Interface Activity</smile:title>
<smile:types><smile:type>W3C Activity</smile:type></smile:types>
<smile:inlines><smile:inline>HTML, CSS1/2, XSL-FO/XSLT, WAI, SVG, I18N</smile:inline></smile:inlines>
<smile:instances>test1, test2, test3</smile:instances>
<smile:references>
<smile:reference href='http://www.w3c.org/' type='simple' />
<smile:reference href='http://www.w3c2.org/' type='simple' />
<smile:reference href='http://www.w3c3.org/' type='simple' />
</smile:references>
</smile:slide>
...
</some_document>
Following incoming tags are detected:
slide
:-
This signals the begin of a slide.
The mandatory attribute is
tid
, which must contain a topic id. If this particular topic does not exist in the current topic map, an error is flagged.Optionally, the attribute
format
can be used to control the content of this slide.
default
:-
With this tag, default values can be set via attributes which apply to all slides which may follow this tag:
Formats
A format string describes what exactly should be included in the generated slide. The default format is
"%ti %ty %rd %ins %res"
and takes care that a title
, types
, inlines
, instances
and references
are included on a slide in this particular order.
One format specifier is introduced with a '%' character, several such specifiers are separated bu one or more blanks. Following specifiers are honored:
ti
:-
Include a
title
tag containing the title of the slide. This is generated from the baseName of the topic. (Sorry, no scoping yet) ty
andtys
:-
This includes the types (instanceOf, to be exact) of the topic enclosed by a
types
tag. In case ofty
, every instanceOf is embedded with its owntype
tag. In case oftys
all these instanceOfs are concatenated to one string separated by ','. rd
andrds
:-
This includes the resourceData occurrences enclosed by the tag
inlines
. In case ofrd
, every such occurrence is wrapped into its own tag,inline
. In case ofrds
, all strings are concatenated into one character string (again, separated by ','). in
,ins
andinrds
:-
This includes the instances of this topic using the tag
instances
. In case ofin
, the individual instances are wrapped into separateinstance
tags. In case ofins
, they are concatenated via ',' into one string.inrds
behaves likein
except that for every individual instance also its resourceData is included via nesteddescription
tags. res
-
This includes the resourceRef occurrences via a
references
tag. Every individual occurrence is included via areference
tag. This tag is empty, but contains anxlink:href
attribute containing the reference link.
INTERFACE
Constructor
Following fields can be passed:
urlbase
:-
This controls the base URL which will be used to derive an absolute URL for the Topic Map to be loaded, in case the provided URL was relative.
tmbase
:-
The same for Topic Maps in the tm: space.
tau_expr
:-
An Topic Map expression as described in XTM::Virtual. The resulting map will be used as a default unless another map is provided via a astma:map attribute (see below)
default_format
:-
This format string will serve as default if (a) either no slide-wide format has been specified or (b) no slide-specific format can be found.
Methods
This filter captures following SAX events and propagates them to the next filter:
- start_element
- characters
- end_element
AUTHOR INFORMATION
Copyright 2002, Robert Barta <rho@telecoma.net>, All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See
http://www.perl.com/perl/misc/Artistic.html