2016-12-15 26 views
0

我尝试在nodejs上使用JSONIX并使用AJV验证传入的XML。JSONIX/AJV:如何使用JSONIX内的Xinclude进行验证?

通常我用这样的:

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模式。

亲切的问候

马库斯

回答

0

Jsonix不会在此刻支持xi:include。这不是不可能的,但没有实现。因此,AJV在JS对象层次验证时也不能做任何事情,而不是XML。

免责声明我是Jsonix的作者。