如何在Haskell中验证XML(通过XSD文件)?

时间:2022-12-15 17:18:40

I am already using HXT for transforming XML. Now I want to validate the input and output against a XSD-file.

我已经在使用HXT来转换XML。现在我想对一个xsd文件验证输入和输出。

HXT only seem to include RELAXNG and DTD validators.

HXT似乎只包含弛豫和DTD验证器。

I don't really care to use something else for just validating.

我真的不想用别的东西来验证。

1 个解决方案

#1


0  

The closest I can think is HaXml and some elbow grease: https://hackage.haskell.org/package/HaXml-1.25.3

我能想到的最接近的是HaXml和一些手肘:https://hackage.haskell.org/package/HaXml-1.25.3

In particular, you have tools to parse XSD and to validate DTD. However I don't there's an "out of the box" way to validate XSD -- it could be possible to smash the info you want into their DTD format, or you could replicate their validation logic against the parsed XSD.

特别是,您拥有解析XSD和验证DTD的工具。但是,我没有一种“开箱即用”的方法来验证XSD——可以将您想要的信息分解成DTD格式,或者您可以根据解析的XSD复制它们的验证逻辑。

At least that's a start...

至少这是一个开始……

#1


0  

The closest I can think is HaXml and some elbow grease: https://hackage.haskell.org/package/HaXml-1.25.3

我能想到的最接近的是HaXml和一些手肘:https://hackage.haskell.org/package/HaXml-1.25.3

In particular, you have tools to parse XSD and to validate DTD. However I don't there's an "out of the box" way to validate XSD -- it could be possible to smash the info you want into their DTD format, or you could replicate their validation logic against the parsed XSD.

特别是,您拥有解析XSD和验证DTD的工具。但是,我没有一种“开箱即用”的方法来验证XSD——可以将您想要的信息分解成DTD格式,或者您可以根据解析的XSD复制它们的验证逻辑。

At least that's a start...

至少这是一个开始……