JSONIX/AJV:如何在 JSONIX 中使用 Xinclude 进行验证?

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

我尝试在 nodejs 上使用 JSONIX 并使用 AJV 验证传入的 XML。

通常我使用这样的东西:

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>

但现在我会用这个

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>

是否可以使用 JSONIX 和 AJV 来验证这样的结构? 我什至有一个 XSD 和生成的 JSON-Schema。

亲切的问候

马库斯

Jsonix 目前不支持 xi:include。虽然不是不可能,但没有实施。因此,AJV 也无法执行任何操作,因为它在 JS 对象级别进行验证,而不是在 XML.

免责声明我是 Jsonix 的作者。