xpath

xPath query problem

Hello, In a previous question, user helped me but i'm stuck of doing simple request : <?php $nodes = $xPath->query('//table[@class="some_class"]'); But it returns me the whole table datas instead of rows of the table, that's why i want to retrive only "td" of the table. I tryed (but it's not working) <?php $nodes = $xPath->query('...

How would you find all nodes between two H3's using XPATH?

How would you find all nodes between two H3's using XPATH? ...

Convert XML tree into flat list of nodes using XSL

How can I convert this XML <albums> <album title="New Zealand"> <album title="Auckland"> <image title="Mt Eden railroad station"/> <image title="Morgan St"/> </album> </album> <album title="Russia"> <image title="Capital of Siberia"/> </album> </albums> into that <div cl...

PHP+Xpath: remove first child?

I have a xpath expression that returns a list of urls that are in a table. I now need a way to remove the first tr, is this possible using one xpath expression? FYI the expression looks like this: form[@id='form1']/div[@id='cont']/div[@id='mycont']/div[@id='holder']/div[@id='resultslist']/div[2]/table//tr/td[2]/a/@href The relevant...

Building nested hierarchy of ids using XSLT

Continuing my previous question. XML <albums> <album title="new_zealand"> <album title="auckland"> <image title="mt_eden_railroad_station"/> </album> </album> </albums> Expected output <div> <a href="#new_zealand">new_zealand</a> </div> <div id="new_zealand"> <a href="#new_zealand/aucklan...

XPath expression to select nodes between a defined sequence of preceding and succeeding nodes

I've got the following structured XML file: <w:document> <w:body> <w:p> <w:r> <w:t/> </w:r> </w:p> <w:p> <w:r> <w:t/> </w:r> </w:p> <w:p> <w:r> <w:instrText/> </w:r> </w:p> ...

Collect a particular attribute from all matching elements in selenium client?

hi all. I'm using selenium-client to test a site. I want to get all a tags matching a particular selector, and then get the href attributes back in an array. Can anyone tell me how i can do this? For example, this returns the href of the first matching 'a' tag: browser.get_attribute "//a[contains(@id,'friendImageLink')]/@href" => ...

xPath: Select parent element only if child element doesn't contain a certain value

Given this: <element_1> <element_2>Text</element_2> <element_3> <element_4> <element_5>Text with @ in Value</element_5> </element_4> <element_4> <element_5>Test Text</element_5> </element_4> </element_3> <element_6> <element_7> <eleme...

Html Agility Pack: Find Comment Node

Hello! I am scraping a website that uses Javascript to dynamically populate the content of a website with the Html Agility pack. Basically, I was searching for the XPATH "\\div[@class='PricingInfo']", but that div node was being written to the DOM via Javascript. So, when I load the page through the Html Agility pack the XPATH mention...

How to query HTML with x XPath expression in C++?

I have a webbrowser and I use DocumentComplete to read the current document from the WebBrowser (as IHTMLDocument2). What's the easiest way to run xpath queries in that html doc? I am looking for something easy to use and lightweight. I am using Visual Studio C++ 2010. ...

How can I do type-safe Xpath queries in Java?

I'm currently using JDOM for doing some simple XML parsing, and it seems like nothing's type safe - I had a similar issue with using the built-in Java DOM parser, just with lots more API to wade through. For example, XPath.selectNodes takes an Object as its argument and returns a raw list, which just feels a little Java 1.1 Are there g...

PHP's Xpath to parse for a url in a form's action attribute.

Considering this HTML code: <div id="something_unique"> <form action="http://the_needed_link"&gt; </form> </div> How do we get the needed link assuming that there is a lot of form tags on the page but we do only need the one that is in a div that has a unique id? ...

Restrict output by range in XSLT

I am creating an XSLT and i want to select a particular node, only if one of its child element's value is between a range. The range is to be specified using parameters in the xsl file. The XML file is like <root> <org> <name>foo</name> <chief>100</chief> </org> <org parent="foo"> <name>foo2</name> <chief>106</chief> </org>...

XSLT, finding out if last child node is a text node

Look at the following two examples: <foo>some text <bar/> and maybe some more</foo> and <foo>some text <bar/> and a last <bar/></foo> Mixed text nodes and bar elements within the foo element. Now I am in foo, and want to find out if the last child is a bar. The first example should prove false, as there are text after the bar, but ...

Xpath test if is number

How i can check with xpath if e node value is number? Any ideas? ...

Limiting an XPath predicate: predicate starting with ...

I am navigating this office open xml file using XPath 1.0 (extract): <sheetData ref="A1:XFD108"> <row spans="1:3" r="1"> <c t="s" r="A1"> <is> <t>FirstCell</t> </is> </c> <c t="s" r="C1"> <is> <t>SecondCell</t> </is> </c> ...

How do I get an XML node with xpath in a loop, based on an attribute with the same name as the attribute in the tree I'm searching?

I cant really formulate that better, so I'll go with an example instead: XML: <root> <foo> <bar id="1">sdf</bar> <bar id="2">sdooo</bar </foo> <feng> <heppa id="4">hihi</heppa> <heppa id="2">sseeapeea</heppa> <heppa id="1">....</heppa> </feng> </root> XSLT: <xsl:for-each select="/root/foo/bar"> <p> ...

Using xpath on a PHP SimpleXML object, SOAP + namespaces (not working..)

Hello, After researching this on SO and google for hours now... I hope to get some help here: (I am just one step away from running a regex to remove the namespaces completely) First this is the XML: <?xml version="1.0" encoding="utf-16"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt; <soap:Header xmlns="...

XPath of non-tagged sibling

For instance, what XPath would return "text one", "text two", and "text three"? <root> <item> <richtext> <par> <break /> text one <break /> text two <break /> text three </par> </richtext> </item> </root> The number of <break/> tags varies. ...

Howto find the first common XPath ancestor in Javascript?

Hi, I have two XPaths, for example: /html/body/div[3]/div[4]/table/tbody/tr[2]/td[4] and /html/body/div[3]/div[4]/table/tbody/tr[2]/td[3]/a[2] How can I find the first common ancestor now? In this case it would be /html/body/div[3]/div[4]/table/tbody/tr[2]/. I found this question but the solution is in ruby and doesn't really give ...