xpath

xpath: //tag[@attr] vs. //tag[attr]

Xpath question: When to use @ with an attribute and when not to. Does it matter? What is the difference ...

XPath Transform messes up with xmlns

Hi, I'm making a tool to create some xml files signed, and I need to use an XPath so my sign doesn't sign itself : <ds:Transforms> <ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116"&gt; <ds:XPath>not(ancestor-or-self::ds:Signature)</ds:XPath> </ds:Transform> <ds:Transform Algorithm="http://www.w3....

What is the syntax to check for element present using Style in IE

I have the following line that works for Firefox assertTrue(!selenium.isElementPresent("//input[@name=\""+chosen.getField().getName()+"\" and contains(@style, \"color: rgb(255, 0, 0);\")]")); But Fails in IE. When i inspect the field in IE, i see the color style represented in hexadecimal. How would you represent the line above to w...

How to use regex in selenium locators

I'm using selenium RC and I would like, for example, to get all the links elements with attribute href that match: http://[^/]*\d+com I would like to use: sel.get_attribute( '//a[regx:match(@href, "http://[^/]*\d+.com")]/@name' ) which would return a list of the name attribute of all the links that match the regex. (or something li...

MS VBA and XPath 2.0

Do any VBA libraries exist which will allow me to use XPath 2.0 within VBA? MSXML6 does not work with XPath 2.0. Basically, I want to parse XML documents using XPath 2.0 as it allows me to use functions within the XPath expression to filter the XML document. As an example, the usage of the function current-date() would be useful as I w...

XPath to return string concatenation of qualifying child node values

Can anyone please suggest an XPath expression format that returns a string value containing the concatenated values of certain qualifying child nodes of an element, but ignoring others: <div> This text node should be returned. <em>And the value of this element.</em> And this. <p>But this paragraph element should be ignor...

Can Selenium evaluate all XPath elements?

Is it possible for Selenium to evaluate all the elements that may match a certain XPath? For instance, I'd like to evaluate whether all checkboxes are checked with //input[type='checkbox']--problem is I only get one element returned. ...

Finding elements with XPath in Delphi

Hi. I am trying to find an element in an XML document in Delphi. I have this code, but it always says 0 elements in the log: function TForm1.KannaSidu: Boolean; var Doc: IXMLDOMDocument; List: IXMLDomNodeList; begin try Doc := CreateOleObject('Microsoft.XMLDOM') as IXMLDomDocument; Doc.async:=False; Doc.load(Filename)...

Using XPath in C#.NET

I am planning to use XPath to query an XML file. Can you please point me to a link which states the advantages of using XPath? Will the use of XPath improve performance? I am using .NET Framework 2.0. At present I am iterating through the node. XmlReaderSettings settings = new XmlReaderSettings(); settings.IgnoreWhitespace = true; XmlR...

xpath expression to select child node based on parent properties

<module> <component> <section> <ptemplateId root="1.8"/> <entry> <observation> <templateId root="1.24"/> </observation> </entry> </section> </component> <component> <section> <ptemplateId root="1.10"/> <entry> <observation> <templateId root="1.24"/> </observation> ...

How to read attribute of a parent node from a child node in XSLT

Just want to know how to read an attribute of a parent node from a child node in XSLT. code: <A> <b attr1="xx"> <c> </c> </b> </A> XSLT: <xsl:template match="c"> <xsl:value-of select="attribute of b node"> </xsl:template> ...

How to get the full source of a link using selenium

I'm using selenium RC and want to get all the attributes and all. Something like: link = sel.get_full_link('//a[@id="specific-link"]') and the result would of: print link would be: <a id="specific-link" name="links-name" href="url"> text </a> Is this possible? thanks ...

Retrieving xpath of the selected text in browser

I want to retrieve the xpath of the currently selected text in a browser. Using JavaScript I am able to get the selected text, but was not able to get the xpath. I can find the xpath manually using Firebug, but I want to do it programatically. Is it possible to do it? [EDIT] Okay, found a pointer to the solution in this thread. Modifie...

Problem extracting xml text with Erlang xmerl_xpath

I'm trying to extract text from an xml node using Erlang's xmerl_xpath: [include "xmerl.hrl"] {Doc, _}=xmerl_scan:string("<node>Hello World</node>"). [#xmlText{value=Text}]=xmerl_xpath:string("//node/text()", Doc). Text. "Hello World" Works fine for this simple example. Problem occurs when the text in the node element is very larg...

Finding all valid xpath from xml

I am trying to write a program in java where in i can find all the xpath for the given xml.I found out the link on the internet xpath generator but it does not work when one element can repeat multipletimes for example if we have xml like the following :- <?xml version="1.0" encoding="UTF-8"?> <Report> <Name> <FirstName>A</Firs...

how to write xslt scripts in XSLFO for adding header & Footer in the blank pages ?

I have written xslt scripts header & footers for blank pages, it is just a copy of the normal header and footer templates for other pages. The script is working for other pages, but its not working for blank pages..? Could anyone suggest me something? Here is my code: <xsl:template name="insertBodyBlankOddHeader"> <fo:static-conte...

What tool do you use for testing and developing XPath expressions?

I'd like something similar to Gerry Shaw's regex tool, ... but for XPath. I'd prefer a standalone tool, free, built on .NET, WinForms or WPF. EDIT: I found this one on codeplex, which fits my requirements as stated, but it's sort of feature-free. It doesn't even resize. ...

Is it possible to retrieve the original XML from XPathNavigator?

I have an XML document, want to do syntax highlighting. The code uses XPathDocument, XPathNavigator and XPathNodeIterator . After I call Select(), how can I get the original text in the XML document? var xpathDoc = new XPathDocument(new StringReader(this.richTextBox1.Text)); var nav = xpathDoc.CreateNavigator(); XmlNamespaceManager...

Is it possible to retrieve the contents of a html textarea with XPath?

I've looked all over but I can't find any leads. Is it possible to do something like: //textarea/<some kind of function?> or <function>(//textarea) I know I can do this using JS, or any number of other techniques, but I'm asking because I'm using WebDriver and Firefox to test a TinyMCE textarea input, and because of JS execution de...

Is it just me? I find LINQ to XML to be sort of cumbersome, compared to XPath.

I am a C# programmer, so I don't get to take advantage of the cool XML syntax in VB. Dim itemList1 = From item In rss.<rss>.<channel>.<item> _ Where item.<description>.Value.Contains("LINQ") Or _ item.<title>.Value.Contains("LINQ") Using C#, I find XPath to be easier to think about, easier to code...