2016-12-15 23 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的作者。