如何从 xsd 生成 xpath?

时间:2023-01-12
本文介绍了如何从 xsd 生成 xpath?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从 xsd 生成 xpath?XSD 验证 xml.我正在一个项目中工作,我正在使用 java 从 xsd 生成示例 XML,然后从该 XML 生成 xpath.如果有任何方法可以直接从 xsd 生成 xpath,请告诉我.

How can I generate xpath from an xsd? XSD validates an xml. I am working in a project where I am generating a sample XML from the xsd using java and then generating xpath from that XML. If there is any way to generate xpath directly from xsd please let me know.

推荐答案

这类工具存在很多问题:

There are a number of problems with such tools:

很少生成的 XPath 表达式是一个好的表达式.除了位置信息之外,没有这样的工具会产生有意义的谓词.

The XPath expression generated rarely is a good one. No such tool will produce meaningful predicates beyond position information.

没有工具(据我所知)会生成一个 XPath 表达式来精确选择一组选定的节点.

There is no tool (to my knowledge) that would generate an XPath expression that selects exactly a set of selected nodes.

除此之外,在没有学习 XPath 的情况下使用这些工具确实是有害的——它们支持无知.

Apart from this, such tools used without learning XPath are really harmful -- they support ignorance.

我建议通过以下书籍和其他资源认真学习 XPath.

I would recommend serious learning of XPath using books and other resources such as following.

https://stackoverflow.com/questions/339930/any-good-xslt-tutorial-book-blog-site-online/341589#341589

有关更多信息,请参阅以下答案..

See the following answer for more information..

是否有用于 xPath 选择器的在线测试器?

这篇关于如何从 xsd 生成 xpath?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

上一篇:XML 模式验证错误 下一篇:针对 XSD Schema 的 Java XML 验证

相关文章

最新文章