3

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?

  • 2
    I don't know if nxml can do that, but if it can't, then it should be extended to support it, since this can occur in various kinds of XML documents. So I suggest you M-x report-emacs-bug asking for this feature. – Stefan Apr 18 '16 at 16:00
  • Thanks for the tip. But then the question is if it's really appropriate to use this channel for a feature request (since it's arguably not a bug if it's just not officially supported). Maybe I should try the mailing list? – David Ongaro Apr 23 '16 at 5:25
  • I was the head maintainer of Emacs until a few months ago, so you can believe me on this. M-x report-emacs-bug is the normal channel for feature requests. – Stefan Apr 23 '16 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.