xpath

Why doesn't this XPath query returns any nodes?

I'm querying Sharepoint server-side and getting back results as Xml. I want to slim down the Xml into something more lightweight before sending it to jQuery through a WebMethod. However my XPath query isn't working. I thought the following code would return all Document nodes, but it returns nothing. I've used XPath a little before, I t...

In XSLT, how come I can't set the select-attribute of a value-of using xsl:attribute, and what's a good alternative?

I have a constant and a variable that I wann mouch together to select a specific node, this is what I want to do: <xsl:attribute name="value"> <xsl:value-of> <xsl:attribute name="select"> <xsl:text>/root/meta/url_params/ <xsl:value-of select="$inputid" /> </xsl:attribute> </xsl:value-of> </xsl:attribute> How come it doesn'...

Parsing XMl in Android using Xpath

Hi there, I want to parse an xml file using xpath in android, any idea how to do that?? I hope you get the point. Thank you ;) ...

PHP's XPath returns too many elements

I'm trying to use XPath in PHP and I get too many elements. This is my code: libxml_use_internal_errors(true); $document = new DOMDocument; $document->strictErrorChecking = false; $document->loadHTML($text); $xpath = new DomXPath($document); $placeholders = $xpath->query('//div[starts-with(@class, "waf-ph-")]'); print '$placeholders->le...

Querying XML file?

I have a relatively small xml file <g> <page no="1" href="page1.xml" > <pic src="20100101001.jpg">1</pic> <pic src="20100101002.jpg">2</pic> <pic src="20100101003.jpg">3</pic> </page> <page no="2" href="page2.xml" > <pic src="20100101011.jpg">1</pic> <pic src="20100101012.jp...

XPath expressions returning empty

I have a DOM created with namespace 4 namespaces I have namespace mappings set correctly and when I query with any expression that uses my namespace it returns empty. The weird thing is that if I export the DOM to a string and then create a new DOM from there my expressions work like a charm. How can I check that the DOM I'm creating ...

Steps and involvement of implementing a parser (in .Net - and in this case XPath 2.0)

Hi, In the lack of any good free XPath 2.0 implementations for .Net build upon Linq to XML I have thought about implementing my own (also for the experience). But just to be clear (and not building something that exists) these are the XPath 2.0 implementations I have found: Saxon .Net Query Machine - I had problems with this - excepti...

Simple xpath question

I'm thinking this is a very simple xpath question .. I'm just not sure why my xpath isn't working. Here's what my XML looks like <A> <B>foo</B> </A> <C> <A> <B>foo</B> </A> </C> Now .. I want to grab all "A" elements which contain a "B" with contained text "foo". ...

Select unique nodes based on a combination of two attribute values

Hi, I have some XML that looks something like this: <Root> <Documents> <Document id="1"/> </Documents> <People> <Person id="1"/> <Person id="2"/> </People> <Links> <Link personId="1" documentId="1"/> <Link personId="1" documentId="1"/> <Link personId="2" documentId="1"/...

How to find a node(or element) in XPath, when the path to that node is always different

So I'm trying to check the XPath of a block of text to verify that the correct page has been returned. However, for the several sites and designs I'm testing(with Selenium 2), the block of text I'm searching for is always the same, but the XPath to it is always different(the block of text has no defining ID or Class, so I need to check t...

How to select a node without parameters using xpath?

Hi, Let say that I have xml like this: <root> <node light="somevalue">message1</node> <node dark="somevalue">message2</node> <node>message3</node> </root> With xpath usage I need to get "message3". Does anybody know how I can achieve this? ...

Nokogiri and XPath help

Admittedly, I'm a Nokogiri newbie and I must be missing something... I'm simply trying to print the author > name node out of this XML: <?xml version="1.0" encoding="UTF-8"?> <entry xmlns:gd="http://schemas.google.com/g/2005" xmlns:docs="http://schemas.google.com/docs/2007" xmlns="http://www.w3.org/2005/Atom" gd:etag=""> <category te...

What am I doing wrong with XPath?

I am trying to manipulate xsd schema as an xml document that should not be a problem, I believe. But facing troubles with XPath. Whatever XPath I try, it returns nothing. Tried it with or without namespaces but no success. Please help me understand what am I doing wrong? My xml is: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmln...

retrieving XML value dynamically using XSL function

my input xml file looks like <root> <sub> <element1 value="abc"/> <element2 value="123"/> </sub> <sub1> <element1 value="ert"/> <element2 value="abc"/> </sub1> </root> i need an XSLT function which reads below XML file and pulls the xpath expression value specified at map/domain/instance/@xpath from above f...

XPath Specific Question, Selecting a child given value of another child

I need to retrieve all of these types of nodes: <parameter value="thisisthename" name="parameters" /> where type = MyTest and one of the child <parameter value="c:\temp\svn.exe" name="file" /> equals c:\temp\svn.exe Right now I have ert[type='MyTest']/parameters/parameter[@value='c:\temp\svn.exe'] <ert agents="0031"> <type>MyTe...

A better way of selecting multiple elements by attribute name in XPath

Hi, I'm looking to select a collection of elements based on an array of ID names. I'm currently using a giant OR statement essentially: //*[@id='apple']|//*[@id='orange']|//*[@id='banana'] But building that string manually seems messy. Is there something like a nice SQL-esque "WHERE IN [a,b,c]" operator that I could be using? I am...

Editing an html file like xml file

Hi, I need to convert HTML file to iXBRL format. iXBRL format is basically html with some embedded nodes or some information of html file wrapped under ixbrl tags. For this, I will need to SEARCH and REMOVE some nodes from HTML file and WRAP some nodes under iXBRL tags. I'm not able to use XML DOM as it shoots an exception on content t...

What is the effect of this XPATH expression?

What happens when I apply following-sibling::*[1] to the last child? ...

How can I write an XPath selector that picks only non-empty children?

I want to write an XPath expression that selects all non-empty table:table-cell children of the current element. How do I do this? ...

Why can't I use values of nodes I retrieve by using exsl:node-set/set:distinct in an XPath-Expression?

Hello there. In a xslt-stylesheet I'm using the methods exsl:node-set and set:distinct to access and filter unique nodes from a variable that contains a result tree fragment. I can write the values of these nodes into my output file, example: <xsl:variable name="myNodes"> <xsl:call-template name="getNodes"/> </xsl:variable> <xsl:for...