xpath

How do I bind to XmlDataProvider whos source has a default namespace (xmlns) set?

I have XML similar to the following <?xml version="1.0" encoding="utf-8"?> <foo name="FooBar" xmlns="http://mydomain/myapp/ver/myschema.xsd"&gt; <bars v="test"> <bar bat="one"/> <bar bat="two"/> <bar bat="three"/> </bars> </foo> How do I map this in WPF, it works if I don't set the default namespace, ho...

decimal-string() help xml/xforms

i am trying to round a number to 2dp and i am struggling i am trying to use the decimal-string method This is what I had <xf:bind nodeset="/stuff/price" calculate = "if(boolean-from-string(/stuff/amountOff), ((/stuff/items) * (/stuff/duration) * 0.8),/stuff/items* /stuff/duration)" /> This is what I tried <xf:bind n...

Are these two styles of xpath logical 'and' equivalent?

Suppose I have xml like this: <Products> <Product name="Liquid Oxygen"> <Manufacturer name="Universal Exports" country="UK" /> </Product> <Product name="Hydrazine"> <Manufacturer name="ACME Inc." country="USA" /> </Product> <Product name="Gaseous Oxygen" obsolete="true"> <Manufacturer name="Universal Exports" count...

Finding embedded namespace uri's.

Hi, Given the following: You will note that embedded in this xml sample is an Organisation node with its' own namespace declared with xmlns="" This is declared like this rather than using a prefix. Is there any way of finding all the namespaces declared in an xml document using xpath? I have tried a few variations, unfortunately xmlns...

PHP SimpleXML with xpath

I have a small XML file: <wddxPacket version='1.0'> <header/> <data> <struct type='coldfusion.runtime.ArgumentCollection'> <var name='HEADLINE'> <string>Richard Barret's Articles on Leadership and High Performance Organisations</string> </var> </struct> </data> </wddxPacket> I'm trying to use PHP Simp...

XPath Find full HTML element ID from partial ID

Hi I am looking to write an XPath query to return the full element ID from a partial ID that I have constructed. Does anyone know how I could do this? From the following HTML (I have cut this down to remove work specific content) I am looking to extract f41_txtResponse from putting f41_txt into my query. <input id="f41_txtResponse" c...

xsl checking variable doesn't seem to work

when I output the value of the node directly for example: <fo:inline><xsl:value-of select="isEnabled" /></fo:inline> I get the correct string outputted in pdf "true".. but if I set the value of isEnabled directly to a variable and then try to do the comparison on it.. it doesn't seem to work as if the node doesn't exist. <xsl:vari...

How can I bind parent/child ComboBox's against XML datasource?

I have the following XML (simplified example) which should have a parent/child relationship between two ComboBox's. The parent binds correctly but the child does not bind to the parents SelectedItem. When I set xmlns against the foobar XML and remove all namespace references it works as expected. Also if I set ItemsSource="{Binding XPat...

XPath to CSS Selector

I have the following xpath statement in a selenium test: //tbody/tr[td/span[text()='IPODate']]/td[4]/input It gets what I want but my tests are painfully slow in IE6. Anyone know how I would do the same selector as CSS selectors? I think I understand how to do each of these with exception to the text()="IPODate" part. As requested he...

Parsing HTML with XPath/XMLHttpRequest

I'm trying to download an HTML page, and parse it using XMLHttpRequest(on the most recent Safari browser). Unfortunately, I can't get it to work! var url = "http://google.com"; xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", url); xmlhttp.onreadystatechange = function(){ if(xmlhttp.readyState==4){ response = xmlhttp.responseTe...

XML with xpath and PHP: How to access the text value of an attribute of an entry

xml: <entry> <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://picasaweb.google.com/data/feed/api/user/xy/albumid/531885671007533108" /> <link rel="alternate" type="text/html" href="http://picasaweb.google.com/xy/Cooking" /> <link rel="self" type="application/atom+xml" href="http://picasa...

XPATH 1.0 : match not empty elements

I need to match elements that contain neither PCDATA nor children elements. I tried this : .//myelem[count(nodes())=0] but nodes() is unknown in XPATH 1.0. What is the most concise way that you know of to do this in XPATH 1.0 ? ...

XPath to get only the text from within an element (PHP)

Hello Apologies if this has been answered before. I've been trying to construct an XPath expression to retrieve only the text portion from an element such as this (containing text as well as other elements) ... <td id="test"> The text I want. <table> Things I do not want ..... ..... </td> I hav...

Tool to find out XPath

I find XPath difficult to get my head around at times and am looking for a tools that I can point at a line in an xml config file an it will tell me the xpath to the attributes that I need. Any help with this would be much appreciated> ...

PHP - Eliminate results from an XML result set

I think this might be more accurately called "paging"... not sure. I am getting a chunk of XML (lets say 100 nodes) I then want to display only a set number of them at a time on a page. How do you do this? For reference, in .NET it would be something like this: // Get some results. These are an XPathExpression XPathNodeIterator...

Why is XPathNavigator case sensitive?

XPathNavigator navigator = myApp.XML.CreateNavigator(); XPathExpression expression = navigator.Compile("true"); //works XPathExpression expression = navigator.Compile("true or true"); //works XPathExpression expression = navigator.Compile("true OR true) //'System.Xml.XPath.XPathException' ...

Indexing over the results returned by selenium

Hi I try to index over results returned by an xpath. For example: xpath = '//a[@id="someID"]' can return a few results. I want to get a list of them. I thought that doing: numOfResults = sel.get_xpath_count(xpath) l = [] for i in range(1,numOfResults+1): l.append(sel.get_text('(%s)[%d]'%(xpath, i))) would work because doing som...

C# XPath problem

When you run the following code, StatusCode is returned as null. What am I doing wrong? var xml = @"<?xml version='1.0' encoding='UTF-8'?> <kml xmlns='http://earth.google.com/kml/2.0'&gt; <Response> <name>The Name</name> <Status> <code>200</code> ...

XPath - Searching for descendent elements that a) match a filter and b) don't have a specific ancestor.

Hi, I'm trying to get an XPath expression together that will give me all the descendent elements of a node that match a filter (e.g. [contains(@class,"interesting")] but which don't have a specific ancestor e.g. [contains(@class,"frame")]. Probably best explained by example: <div class="frame"> <p class="interesting">alice...

Xpath expression matching several attributes for HtmlAgilityPack

Assuming I want to find a table with certain width and height attributes No problem with doc.DocumentNode.SelectSingleNode("//table[@width='500']"); Would it be possible to add height='500' somehow to this Xpath expression ? ...