xpathengines

XPath syntax within binding XAML

What is the syntax for using XPath with Binding in XAML? Are there any MSDN pages which describe where to put the braces? Visual Studio doesn't like the following: <TextBlock Text="{Binding XPath=/One/Two[@id='0']/Three/@Four}" /> I want the Text of the TextBlock to be set to the value of the Four attribute. ...

Performing complicated XPath queries in Scala

What's the simplest API to use in scala to perform the following XPath queries on a document? //s:Annotation[@type='attitude']/s:Content/s:Parameter[@role='type' and not(text())] //s:Annotation[s:Content/s:Parameter[@role='id' and not(text())]]/@type (s is defined as a nickname for a particular namespace) The only documentation I ca...

Selenium : Xpath parse error in internet explorer

Hi While testing a web app using selenium, I am trying to access a link in a html page. Xpath to this link is //div[div[text()='Report:']]//a[div[text()='Remove All']] This xpath is working in Firefox but in IE i am getting parse error. I verified this xpath using ie webpage source code and xmlspy. but still getting this error while ...

Glassfish v3 and XPath.compile error

We are migrating fairly new web application from tomcat to glassfish and everything is working well except for some xpath code that is used to parse some xml returned from a third party service. The code works wonderful in tomcat but not in glassfish for some reason. Here is a snippet that throws an null pointer exception: XPathExpress...

XPath loop with Selenium and perl

Hi, I'm trying to extract all name values in input fields using selenium and perl. Part of the value, enough to identify it, is known, the rest is unknown: This xpath works in finding all relevant matches: //tr/td//input[contains(@name,'partofname')] So, in perl: my $xpath = qq(//tr/td//input[contains(\@name,'partofname')]); my $c...

XPath must be a literal?

I have a stored proc with a parameter which I want to have contain an XPath expression which can then be used to retrieve a value in a select, but the r.value(...) exception message says that I can only use literals. Is this true or is there a way around this? create proc MySproc @myxml xml, @xpath nvarchar(50) as begin ...

Sitecore query does not support count() function?

Sitecore query is based on XPATH, but looks like it does not support count() function. My query is this: ../*[@@templatekey='topic' and count(child::*) > 0] But gives me "Object reference not set to an instance of an object." error. But if I remove the count() filter, works just fine... Any idea why it doesn't like count? ...

PostgreSQL 8.4 XML, XSLT and XPath possibilities / documentation.

The available PostgreSQL material on XML, XSLT and XPath is limited. There are the official docs from the PostgreSQL team, however these cover only a few pages of content and I've never been convinced that their docs are as comprehensive as they could be. There are also some bits and bobs on sites kicking around, however there is not to...

python 2.5.1 and supported version of xpath

hey.. trying to figure out how to determine what version of XPath is supported by python 2.4.3/2.5.1 using libxml2dom. in looking through various docs, i must be missing something! basically, i'm considering how/if i can have an XPath function, and use regex within the XPath... i understand the XPath v2.0 supports using regex, so i'm ...

SimpleXML and PHP XPath expression not returning correct data

The following PHP code: <html> <?php $name = Secrezy; $server = Sunstrider; $raidurl='http://eu.wowarmory.com/character-achievements.xml?r='.$server.'&amp;cn='.$name.'&amp;c=168'; print_r($raidurl); // This is to check if the link is valid. Follow the link printed here and you should find a valid XML page echo "<br>"; $xmlraid =...

XPath using JDom...

In my code below, I am trying to access my 'handler' XML elements using XPath, but I am having no luck - the 'elemHandler' element is always null. Can anyone share with me the obvious solution? Thanks in advance. import java.io.IOException; import java.io.StringReader; import org.jdom.Element; import org.jdom.JDOMException; import org....

XPath NodeSet in Java

I have this code in eclipse NodeSet nodes = (NodeSet) xPath.evaluate(expression,inputSource, XPathConstants.NODESET); and its giving me compile time error on NodeSet. These are the stuff that I have imported. Can you tell me why it's doing this? import javax.xml.xpath.*; import org.xml.sax.InputSource; import java.io.File; import j...

Querying an HTML page with XPath in Java

Hi, Can anyone advise me a library for Java that allows me to perform an XPath Query over an html page? I tried using JAXP but it keeps giving me a strange error that I cannot seem to fix (thread "main" java.io.IOException: Server returned HTTP response code: 503 for URL: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd). Thank...

Java NUX library, XPATH Performance

I am using the NUX library to run ~20 xpaths queries on an XML ~20KB in two different settings, one in a JUnit test, the other inside a bean in a Jetty servlet (hence running in a multi-threaded scenario.) It seems like when ran in Junit, it is evaluating the XPaths in ~8ms, whereas in the Jetty servlet it is taking ~80ms to evaluate. In...

XPATH based content extraction from html pages

Hi, I m trying to extract content based on given xpath. When it is just one element i want to extract, there is no issue. When I have a list of items matching that xpath, then i get the nodelist and i can extract the values. However, there are a couple items related to each other forming a group, and that group repeats itself. One way ...

XPath select node with periods

I have an XML document where some of the nodes have a . in their name. <com.site.blah> <id>asdkjasd</id> <com.site.testing> <name>test</name> </com.site.testing> </com.site.blah> If I do @doc.search("/*/id").first.xpath it returns /com.site.blah/id, but if I then do: @doc.search("/com.site.blah/id").first.inspect it r...

Which are the Java JAXP XPath implementations available?

Which are the Java JAXP XPath implementations available? The default implementation, Xalan (shipped with the JVM), is very slow to evaluate XPath expressions, so, I'm looking for a faster implementation. ...

How does Ruby's REXML or REXML::XPath take an element and access its children nodes?

If the following code in Ruby can print out "browser type" and "count" individually as 2 separate lists, can REXML select each entry and then print out entry['title'].text and entry['dxp:metric'].attr('value') /* not using exact syntax */ on the same line as one list? require 'rexml/document' include REXML xmlfile = File.new("data....

java: xpath on json

I need a fast way to extract data from json responses a I get from a webservice. By fast, I mean fast for the programmer, not necessarily for the computer. I was thinking of something like Xpath for Json, if such a thing exists. Any ideas? I am open to any Java Json library. In fact, the easiness to extract data from Json with a power...

What methods are present to select elements in chrome extensions?

I know about getElementById, getElementByNames ... and getElementsByTagName What other methods are available to select an element or elements from the DOM ? What if an item does not have an Id or Name. I have heard that I can use XPath expression to select a range of HTML elements. How do i do that using JavaScript? Is there a library ...