[英]How to search for specific attribute of multiple XML nodes with jQuery
Bear with me, I'm new to manipulating XML using jQuery. 忍受我,我是使用jQuery处理XML的新手。
Say I have an XML document that looks something like this: 说我有一个看起来像这样的XML文档:
<sitemap>
<products name="products" url="/products.html">
<shirts name="women's shirts" url="/womens-shirts.html">
<shoes name="women's shoe" url="/womens-shoes.html">
<pants....>
</products>
<services>
<shopping>
<consultation>
</services>
</sitemap>
etc., where each child node of has both a name and a URL (I'm populating a breadcrumb based on window.location.pathname). 等等,其中的每个子节点都有一个名称和一个URL(我正在基于window.location.pathname填充面包屑)。 I want to search for a specific URL (it should match whatever page you're on), which can be in any node, either parent or child. 我想搜索一个特定的URL(它应与您正在访问的任何页面匹配),该URL可以位于任何节点中,无论是父节点还是子节点。 How do I do this without specifying the node I am searching under? 如何在不指定要搜索的节点的情况下执行此操作?
Thanks! 谢谢!
要指定任何元素名称,请使用星号:
*[url='/products.html']
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.