如何根据其内容选择XML节点?

前端之家收集整理的这篇文章主要介绍了如何根据其内容选择XML节点?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何使用XPath根据其内容选择 XML节点?

如果我有以下xml,我想选择包含Ritchie的< author> -node来获取作者的全名:

<books>
    <book isbn='0131103628'>
        <title>The C Programming Language</title>
        <authors>
            <author>Ritchie,Dennis M.</author>
            <author>Kernighan,Brian W.</author>
        </authors>
    </book>
    <book isbn='1590593898'>
        <title>Joel on Software</title>
        <authors>
            <author>Spolsky,Joel</author>
        </authors>
    </book>
</books>
/books/book/authors/author[contains(.,'Ritchie')]

要么

//author[contains(.,'Ritchie')]
原文链接:https://www.f2er.com/xml/292884.html

猜你在找的XML相关文章