mjscott2702 has asked for the wisdom of the Perl Monks concerning the following question:

Esteemed Monks,

I am trying to write a script to clean up some JSP files, changing some tags etc, and would like to stay true to the principle of laziness.

Does anybody know of any modules out there for parsing Java Server Pages files (JSP's)? Something similar to the HTML::TreeParse module family would be ideal - looking on CPAN, all of the JSP related modules are for JavaScript, which is not the same thing.

Replies are listed 'Best First'.
Re: Parsing Java Server Pages (JSP)
by Anonymous Monk on Nov 01, 2010 at 15:42 UTC
    1. Convert JSP pages to JSP documents (JSPX) with Jsp2x
    2. now that you have XML, you can use pretty much anything to perform your transformations, XML::Twig... pQuery
      Interesting approach, and may also help to highlight JSPs with badly formed HTML. However, can I perform the reverse conversion i.e. get JSPs back from the modified XML?

      Guess I need to read up on Jsp2x....

        Scratch that, don't need to do the reverse...