Get XPath Content
Get XPath Content extracts parts of HTML with an XPath query. Use it to take one block of a page, such as the article body or a price.
Input and output
- Input:
html, such as thecontentof the Links engine or thefull_htmlof Get Fulltext. - Output:
htmlwith every element the query found.
Options
- XPath Query: the query. JoomGrabber puts the input inside
<div id="xpath_extractor">and your query is added after//div[@id='xpath_extractor']. So you write the rest of the path, starting with//. - Node wrap: a tag name to wrap each found element in, such as
pordiv. Leave empty to keep the elements as they are.
Examples
| You want | XPath Query |
|---|---|
| The article body | //div[@class='article-body'] |
| Every paragraph | //p |
| The main image | //figure[1]//img |
| A block by ID | //*[@id='content'] |
| Elements with a class among others | //div[contains(@class,'entry')] |
Tips
- In Chrome or Firefox, right-click the element, choose Inspect, then Copy > Copy XPath. Remove anything before the part you need, and start with
//. - XPath is case-sensitive:
@class='Article'does not matcharticle. @class='a'only matches when the class is exactlya. Usecontains(@class,'a')when the element has several classes.