Search code examples
xmloozie

Oozie email action escape tags


we have a following oozie email action

<email xmlns="uri:oozie:email-action:0.1">
    <to>some-email</to>
    <subject>some subject Failure</subject>
    <body>
        Error (Code) Message:(${wf:errorCode(wf:lastErrorNode())}) ${wf:errorMessage(wf:lastErrorNode())}
    </body>
</email>

The contents of error message have some text like <init> . This is causing the oozie email action to fail with following error,

JDOMParseException: Error on line 36: The element type \"init\" must be terminated by the matching end-tag \"</init>\".

I couldn't able to find a way to escape those characters. any suggestion would be helpful.


Solution

  • This is because the body need to be a plain-text (see here)

    You can use other EL functions to do simple xml escaping by using the replaceAll or you can encode the body to utf-8.