Hey,
A possible XML extension for Apache::ASP came up when
Paul Linder created an internal mapping for <msg>$string</msg>
to translate to Locale::PGetText::gettext($string), for
internationalization, and only for his version of the module.
I think that it would be good to extend this mechanism
in general, such that any <tag></tag>, or just <tag args>
could be mapped to a subroutine, thus implementing
generic XML extentions for the module.
Here's my try at this... a generic XML tag set seems to
look like <tag %args>[$string</tag>] where the part in
brackets is optional ... maybe if XMLSubs is set to
some tag names, these tags would then have their namesake
function called.
So Paul would set XMLSubs to msg, then define the msg()
function in global.asa which would then be called. $string
would get set to $_, and args would be passed in as %args,
so internally this would happen:
$_ = $string; &msg(%args);
I thought about passing %args in as a hash ref &msg({%args}),
but think that this might slow things down for the common
use, with less %args, with the overhead of creating the
hash ref, also the @_ for sub msg{} would be easier to
work with as just my %args = @_;
So then for Paul, he would have defined in his global.asa
sub msg { Locale::PGetText::gettext($_) }
for his <msg>$string</msg> XMLSubs mapping. The return
output would be inserted into the final HTML.
What about embeded XML tags you ask? Good question. Its
really an implementation nightmare for me to solve, but
I would have to keep breaking up $_ into smaller parts,
resolving the deepest tag first, allowing tags to operate
on the output of embedded tags, like
<msg>
<msg2>$string</msg2>
</msg>
where the output from &msg2 would be set to $_ for &msg.
Matt, I have also CC'd you here, since you are the
XML pro in these parts.
Any suggestions or feedback ? Thanks.
-- Joshua
_________________________________________________________________
Joshua Chamas Chamas Enterprises Inc.
NodeWorks >> free web link monitoring Huntington Beach, CA USA
http://www.nodeworks.com 1-714-625-4051