Michael Koehne > XML-Filter-Hekeln-0.06 > hekeln

Download:
XML-Filter-Hekeln-0.06.tar.gz

Annotate this POD

View/Report Bugs
Source  

NAME ^

hekeln - command line interface to the Hekeln SAX stream editor

SYNOPSIS ^

  hekeln scriptfile < some.xml > some_processed.xml

DESCRIPTION ^

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.

OPTIONS ^

  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.

ABUSE ^

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.

AUTHOR ^

  Michael Koehne, Kraehe@Copyleft.De
  (c) 2000 GNU General Public License

SEE ALSO ^

XML::Parser::PerlSAX and XML::Filter::Hekeln

syntax highlighting: