Proposal: SAX filter for conditional XML
by Paul LeoNerd Evans other posts by this author
Jun 3 2007 7:11AM messages near this date
view in the new Beta List Site
Re: Registered function not directly selectable?
|
Re: Proposal: SAX filter for conditional XML
& XSLT I have a requirement to process some XML with conditional constructs in,
looking somewhat like the following:
<message>
<switch cond="today()">
<case value="tuesday"> Today is Tuesday</case>
<case value="wednesday"> Today is Wednesday</case>
<otherwise> Today is neither Tuesday nor Wednesday</otherwise>
</switch>
</message>
I have managed to write this as a SAX filter, which removes the actual
<switch> , <case> and <otherwise> elements, and all of the contents of any
<case> node that doesn't match.
The actual evaluation of the condition expression, and matching it to one
of the cases, is done in specific methods, that allow for a generic
implementation, leaving the specifics to some subclass being used in an
application.
I couldn't find anything on CPAN that looked like it does this already,
so I would like to propose to create such a module; likely called
XML::Filter::Conditional
unless anyone has any objections, or better suggestions.
--
Paul "LeoNerd" Evans
leonerd@[...].uk
ICQ# 4135350 | Registered Linux# 179460
http://www.leonerd.org.uk/
Thread:
Paul LeoNerd Evans
Paul LeoNerd Evans
Paul LeoNerd Evans
Grant McLean
Paul LeoNerd Evans
|