Oozie 电子邮件操作转义标签

Oozie email action escape tags

我们有以下 oozie 电子邮件操作

<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>

错误消息的内容有一些像 <init> 这样的文本。这导致 oozie 电子邮件操作失败并出现以下错误,

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

我找不到转义这些字符的方法。任何建议都会有所帮助。

这是因为正文需要 plain-text(参见 here

您可以使用其他 EL functions 通过 replaceAll 进行简单的 xml 转义,或者您可以将正文编码为 utf-8。