开发者

libxml2 - validate XML document against schema. Retrieve schema url from the actual XML file

开发者 https://www.devze.com 2022-12-17 19:38 出处:网络
I need to validate a xml file against DTD schema. I found out that I need to pass the source of schema file for validation. Is that possible to make libxml2 find the declaration of schema in XML file

I need to validate a xml file against DTD schema. I found out that I need to pass the source of schema file for validation. Is that possible to make libxml2 find the declaration of schema in XML file and do the validation on its own, or do I have to retrieve开发者_如何学编程 the declaration manually?

Thanks in advance Michal


In theory you could use put an xsi:schemaLocation attribute in the XML file and let the XML processors find out where the XML Schema is.

The status of xsi:schemaLocation in libXML is unclear, see this bug report: https://bugzilla.gnome.org/show_bug.cgi?id=157205. It seems implemented in the library itself but not enabled in the provided xmllint util.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号