hekeln - command line interface to the Hekeln SAX stream editor
hekeln scriptfile < some.xml > some_processed.xml
Hekeln is a PerlSAX stream editor. The hekeln script provides a shell interface for this tool, that could be used for testing hekeln scripts or to embed them into other languages.
Currently no options ;-(
I think that the set of options used in YAWriter are a good start, lets look what we additonal need for processing batches.
Its possible to "chmod u+x" a Hekeln script, but syntax is a bit nasty! Lets look at a template :
#!/usr/bin/perl /usr/bin/hekeln # this comment is IMPORTANT <blank-line> start_element:topmost_element ! $self->handle('start_document',{}); < top_tag > <blank-line> start_element:second_element < second_tag > ++ process_it <blank-line> start_element:second_element -- process_it </ second_tag > <blank-line> start_element:topmost_element </ top_tag > ! $self->handle('end_document',{}); <blank-line> character:process_it ~Data~
This script would search through an xml for the occurance of the 'topmost_element' to open a new xml output document. Any character data in a 'second_element' will be dumped.
How blank lines and tabs are aranged is for importance! In a Hekeln script any paragraph that starts with a '#' is ignored, so we need the blank line, and therefore at least one comment in any script!
Also paragraphs that do not match the '^[^:]+:[^:]+$' template for the first line and any line in an interpreted paragraph that does have a valid indicator are silently ignored. Perhaps future version will raise warnings and errors.
Michael Koehne, Kraehe@Copyleft.De (c) 2000 GNU General Public License
XML::Parser::PerlSAX and XML::Filter::Hekeln
To install XML::Filter::Hekeln, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::Filter::Hekeln
CPAN shell
perl -MCPAN -e shell install XML::Filter::Hekeln
For more information on module installation, please visit the detailed CPAN module installation guide.