So I'm trying to parse some of the WootAPI with XPath. A problem that I'm running into is that a couple of the elements have colons in their name, such as woot:price
or woot:condition
. Now, trying to use the XPath //rss/channel/item/woot:price
won't grab the contents of the element woot:price
, because of the colon, I think. What can I do to get it anyway?
相关问题
- XPath How to retrieve the value of a table cell fr
- How to send text to the search field through Selen
- PHP Getting XPath of a DOMNode
- Using XPath to access comments a flat hierachy
- Click all elements with same CssSelector or same X
相关文章
- scrapy爬虫数据清洗
- How do I access an element with xpath with a names
- Java XPathFactory thread-safety
- Retrieving Namespaces from Element in Java (using
- How to locate element by class name and specific a
- How to pass string to an XPath containing text?
- How to using XPath in WebBrowser Control?
- Read inside a Specific Tag using XPath with multip
The colons are because the elements have a namespace prefix and are bound to the Woot namespace.
You should read up on XML namespaces and how they affect XPATH and XSLT.
If you want to reference the Woot elements in your XPATH you will either need to:
http://www.woot.com/
so that when you use that namespace prefix in your XPATH it will be understood.local-name()
andnamespace-uri()
to match the element.//rss/channel/item/*[local-name()='price' and namespace-uri()='http://www.woot.com/']