我尝试在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。
亲切问候
马库斯
发布于 2016-12-16 14:20:16
Jsonix目前不支持xi:include。这并不是不可能的,但没有实现。因此,AJV也不能做任何事情,因为它在JS对象级别上验证,而不是在XML上。
免责声明我是Jsonix的作者。
https://stackoverflow.com/questions/41168305
复制相似问题