jsonnode.jsxmlxincludejsonix

JSONIX / AJV: how to use Xinclude inside JSONIX for validation?


I try to use JSONIX on nodejs and using the AJV for validation of the incoming XML.

Normally I use something like this:

News.xml:

<news xmlns="http://news24.tt/news">
  <publisher>
    <author>Max Mustermann</author>
    <company>NEWS24</company>
    <resort>Sports</resort>
  </publisher>
  <topic>HSV wins against FCB!</topic>
  <article>Bla bla ... </article>
</news>

but now I will use this

Author.xml:

<publisher xmlns="http://news24.tt/news">
  <author>Max Mustermann</author>
  <company>NEWS24</company>
  <resort>Sports</resort>
</publisher>

News.xml:

<news xmlns="http://news24.tt/news" xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include href="Author.xml" />
  <topic>HSV wins against FCB!</topic>
  <article>Bla bla ... </article>
</news>

Is it possible to use JSONIX and AJV to validate even such structures? I even have a XSD and the generated JSON-Schema.

kind regards

Markus


Solution

  • Jsonix does not support xi:include at the moment. It's not impossible though but not implemented. Therefore AJV also won't be able to do anything as it validates on the JS object level, not on XML.

    Disclaimer I'm the author of Jsonix.