問題描述
如何從 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 表達(dá)式是一個好的表達(dá)式.除了位置信息之外,沒有這樣的工具會產(chǎn)生有意義的謂詞.
The XPath expression generated rarely is a good one. No such tool will produce meaningful predicates beyond position information.
沒有工具(據(jù)我所知)會生成一個 XPath 表達(dá)式來精確選擇一組選定的節(jié)點.
There is no tool (to my knowledge) that would generate an XPath expression that selects exactly a set of selected nodes.
除此之外,在沒有學(xué)習(xí) XPath 的情況下使用這些工具確實是有害的——它們支持無知.
Apart from this, such tools used without learning XPath are really harmful -- they support ignorance.
我建議通過以下書籍和其他資源認(rèn)真學(xué)習(xí) 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
有關(guān)更多信息,請參閱以下答案..
See the following answer for more information..
是否有用于 xPath 選擇器的在線測試器?
這篇關(guān)于如何從 xsd 生成 xpath?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!