簡體   English   中英

使用區分大小寫搜索具有多個屬性的XML文件

[英]Search XML File with Multiple Attributes with Match Case

如何通過使用XML文件中的XPath使用“區分大小寫”來搜索多個子節點值。 我有下面的XML文件。

<catalog>
  <book id="BK-1001">
    <title>C# 2005 Programmer's Reference</title>
    <author>Adrian Kignsley</author>
    <genre>.NET</genre>
    <price>0</price>
    <publish_date>2006-11-1</publish_date>
    <description>This is reference book.</description>
  </book>
  </catalog>

我想使用Match Case根據標題,作者和體裁進行搜索。 我正在使用此表達式:

"book[title='" + strInputString_1 + "'] | book[author='" + strInputString_2 + "'] | book[genre='" + strInputString_3 + "']"

但是,它沒有用。 我該怎么做?

您在XPath的開頭缺少//

"//book[title='" + strInputString_1 + "'] | //book[author='" + strInputString_2 + "'] | //book[genre='" + strInputString_3 + "']"

您可以嘗試以下操作:

"//book/title[.='" + strInputString_1 + "'] | //book/author[.='" + strInputString_2 + "'] | //book/genre[.='" + strInputString_3 + "']"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM