I often use emacs to edit oozie workflow/coordinator definitions and nxml mode is pretty handy for that. I never bothered much to get more than basic xml validation since schema-based validation seemed too complex to set up for me. But it turns out once I figured how to convert the provided xsd schemas to rnc (with the help of http://debeissat.nicolas.free.fr/XSDtoRNG.php and trang and some hand editing) it's actually quite easy by adding the correct path to the schema.xml
.
E.g. I can add this line
<namespace ns="uri:oozie:workflow:0.1" uri="workflow-0.1.rnc"/>
and so every xml which has the xmlns
attribute uri:oozie:workflow:0.1
gets validated with the workflow-0.1.rnc
schema. The sad thing is that this is only working for root elements, but oozie supports "Actions Extensions" with its one namespace and schema. E.g.
[...]
<action name="sendFailureEmail">
<email xmlns="uri:oozie:email-action:0.1">
<to>${toEmailAlias}</to>
<subject>...</subject>
<body>...</body>
</email>
<ok to="fail"/>
<error to="fail"/>
</action>
[...]
All three subelements of email
(to
, subject
and body
) are marked as "invalid" in nxml because they are not specified in the workflow-0.1.rnc schema. I also generated the rnc version of the email-action schema and put in
<namespace ns="uri:oozie:email-action:0.1" uri="email-action-0.1.rnc"/>
into my schema.xml
but that doesn't help since it only applies for root elements.
Is there an easy way to get nxml to recognize nested namespaces for validation or is this simply an unsupported feature?