xpath

XPath to locate an <TD> tag with a specific text in OnClick

Hi, I have the following HTML: <td onclick="fbm_bet('53987976','1','6','')" class="bfbhlt"> Is it possible to use Xpath to locate the looking for the number 53987976. Something similar to: //td[@contains="53987988"] Many thanks, Stefan ...

XPath selection while excluding elements having certain attribute values

Hello all, My first post here - it's a great site and I will certainly do my best to give back as much as I can. I have seen different manifestations of this following question; however my attempts to resolve don't appear to work. Consider this simple tree: <root> <div> <p>hello</p> <p>hello2</p> <p><span c...

DOMDocument XPath

Can somebody show me some examples to import a html-page and use the XPath to find the keywords including the rest of the text from the div, p, title etc. Thank you! EDIT: In this case i use my webcrawler for example, i have a form to get the website to be crawled and the keywords wich has to be find in pages of the website. http://c...

xslt select grandparent node depending on an attribute value of its grandchild node

I'm trying to add different tags to a node depending on an attribute value of its grandchild node. Sample Input (a 1x3 table): <table> <row> <cell row="1" column="1" >heading text one</cell> </row> <row> <cell row="2" column="1" >body text one</cell> </row> <row> <cell row="3" column="1" >bo...

id() in XPATH with .NET

I'm trying to query XML through XPATH but is having problem getting id() to work. I would like to get all the authors for a book, specifying the book ID. Here's the XML. <?xml version="1.0" encoding="utf-8" ?> <bookstore xmlns="http://litemedia.se/BookStore.xsd"&gt; <book id="ISBN9789170375033"> <title>I väntan på talibanerna</ti...

xsl if and xsl foreach where element value is...

hi all, this is my xml: <root> <a> <b> <t>1</t> </b> <b> <t>2</t> </b> </a> </root> i want to ask: thats tell me if any t exist but i want true answer onky if b exsit and he have t=1 tanks ...

using xpaths in javascript

I have a large set of XPaths for selecting content in webpages and I want users to be able to use them in the browser (including IE). What do you recommend? Try and interpret the XPaths with JavaScript? Or perhaps convert to regex? Some existing JavaScript XPath work: http://js-xpath.sourceforge.net/xpath-example.html http://goog-aja...

Xpath preceding-sibling (using HtmlAgilityPack and VB)

Im using HtmlAgilityPack/HAP so that I can use Xpath with HTML documents. I need help selecting the preceding-sibling of div class="address" in this url: www.yellowpages.ca/search/si-geo/1/sh/Ottawa,+ON The sibling that I want is h3 class="listingTitleLine" Here is a screenshot: http://i55.tinypic.com/25gc4qo.png Can I get some help ...

XPath Powershell query for a string

Hi, I'd like to know how to search for a string within an xml document. The object type is System.Xml.XmlNode.XmlDocument. The string can be anything with the document. I.e. attribute or element. I tried Select-Xml -Xml $xml -XPath "./Test" but got no results ...

I want to extract the contents of a node as a string using XPath and PHP

Hi, I have a function that accepts a general HTML file and a general XPath expression. I want to extract a string of the matched node containing the entire text including HTML tags. Here's a simplified example... <?php $inDocStg = " <html><body> <div>The best-laid<br> schemes o' <span>mice</span> an' men <img src='./mous...

Selenium 2.0 IE Xpath Performance

I'm attempting to use selenium-dotnet-2.0a5 to iterate through many tables, and have to use xpath. e.g; var tableRows = _table.FindElements(By.TagName("tr")); foreach (var row in tableRows) { row.FindElements(By.XPath("td|th")); //iterate through tablecells and get text of each } Average times to iterate through about 50 ro...

xslt value-of union priority

Hi all I am trying to set a variable in XSLT 1.0 as follows <xsl:variable name="by" select="Contributors/Contributor[Role='ReMixer']/Name | Attribution" /> The Idea is that if the Remixer Role does not exsit then the variable will take on the value of Attribution, however when testing it always takes on the value Attribution regard...

XPath/XQuery: Select a root node with its attributes without childs

I have an xml: <Customer id=""> <Name /> <Address /> </Customer> I would like to select ONLY a root node with its attributes without its child nodes: <Customer id=""/ > Is such thing possible with XPath? ...

how to retrieve parent node using xquery?

Hi, I am using xml and xqueries.I usually use an xpath expression relative to a parent node to retrieve its child node. But, I am not sure how to do the opposite meaning if I have a child node, how do I retrieve its parent node. <node id="50> <childnode1 childid="51" /> <childnode2 childid="52" /> </node> If I have the node <chi...

Need an XPath that will check an attribute value of any child, grandchild, or great grandchild, etc.

So given this XML... <?xml version="1.0" encoding="UTF-8"?> <root> <tree dah="false"> <tree dah="false"> <tree dah="false"/> <tree dah="false"/> </tree> <tree dah="false"> <tree dah="true"/> <tree dah="false"/> </tree> </tree> </root> ...I need an ...

Wierdness with XDocument, XPath and namespaces

I have an XML document that looks like this: <kmsg xmlns="http://url1" xmlns:env="url1" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance" xsi:schemaLocation="http://location that does not exist.xsd"> <header> <env:envelope> <env:source branch="907" machine="0" password="J123"/> </env:envelope> </header> <body> <Or...

xslt efficient selector usage

Hi, One of xslt stylesheets i have created has many usages of for example <xsl:template match="ProductType"> <xsl:value-of select="../../Title"/> </xsl:template> so my question is would it be more efficient to create a new nodeset manualy including just the data required or perhaps passing in using params? What would constitute bes...

xPath finds nothing but *

This is starting to piss me off real bad. I have this XML code: Updated with correct namespaces <?xml version="1.0" encoding="utf-8"?> <Infringement xsi:schemaLocation="http://www.movielabs.com/ACNS http://www.movielabs.com/ACNS/ACNS2v1.xsd" xmlns="http://www.movielabs.com/ACNS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&g...

How do I get my values out of their SimpleXMLObjects ?

After an xPath, I'm left with this var_dump: array(1) { [0]=> object(SimpleXMLElement)#2 (1) { [0]=> string(11) "22-99586795" } } echoing the damn thing only gives me "Array()" How do I get the bloody string out? Thanks ...

Xpath expression problem

Hi, I want to mach (in real case I use DomDocument php) a link inside: Case: <div class="d1"> <span class="s1"> <a class="myclass">my link</a> </span> </div> My solution that fail: '//div[@class="d1"]/span[@class="s1"]/a[@class="myclass"]' what should i change in my xpath expression? Edit: In real case I have in middle...