問題:
Is there a way to do a wildcard element name match using querySelector
or querySelectorAll
?有沒有辦法使用querySelector
或querySelectorAll
進行通配符元素名稱匹配?
The XML document I'm trying to parse is basically a flat list of properties我試圖解析的 XML 文檔基本上是一個簡單的屬性列表
- I need to find elements that have certain strings in their names.我需要找到名稱中包含某些字符串的元素。
- I see support for wildcards in attribute queries but not for the elements themselves.我看到在屬性查詢中支持通配符,但不支持元素本身。
Any solution except going back to using the apparently deprecated XPath (IE9 dropped it) is acceptable.除了返回使用明顯已棄用的 XPath(IE9 刪除它)之外的任何解決方案都是可以接受的。
解決方案:
參考一: https://en.stackoom.com/question/aYvq參考二: https://stackoom.com/question/aYvq