xpath

correct this xpath expression please

This is a piece of my XML document: <?xml version="1.0" encoding="UTF-8"?> <catalog> <mfVictor> <decal> <company>Victor</company> <title>Wood Horn with Blue Background</title> <image> <url>victor01.jpg</url> <width>60</width> <height>60</height> <name>Wood Horn Blue Background</name> <link></li...

libxml2 error with namespaces and xpath

hello, I am pasting some code here that compiles with no warning using gcc file.c -lxml2, assuming that libxml2 is installed in your system. #include libxml/parser.h> #include libxml/xpath.h> #include assert.h> #include libxml/tree.h> #include libxml/xpathInternals.h> xmlDocPtr getdoc (char *docname) { xmlDocPtr doc; doc = x...

Java XML parsing using XPaths?

Total newbie to XPath and Java here. What I'm attempting to do is something like this: <A> <B> <C>test 1</C> </B> <B> <C/>test 2</C> </B> <B> <C/>test 3</C> </B> </A> for each XMLDoc.children() as BNode array.append(BNode.getXPathValueAt('B/C')); end for each Is there an easy way in Java to use XPaths like that...

How do I select child nodes that don't have a specific parent as an ancestor?

We use CruiseControl for our build server. It compiles our applications using MSBuild and uses its own XML logger that spits out something like the following XML: <project name="CI"> <target name="CompileApp"> <project name="Project1.csproj"> <target name="build"> <error>Compilation error one!</error> </target...

Application of an XPath query to a SOAPMessage in Java

Hi, currently making a SOAP request using Java's SOAPConnectionFactory and SOAPConnection's .call() method, which returns a SOAPMessage object, and I would like to apply an XPath query to it. Is this at all possible, or am I going about it completely wrong? As far as I can work out, I'd have to somehow convert SOAPMessage to an InputSo...

Check if a node exist in XML using XPath in Java

I have different forms of XML that I must analyse, <AMDI> ... <MI> </MI> </AMDI> or <AMDI> ... <AD> </AD> </AMDI> So I want to build an XPath query depending of the type of the node (if it's an MI : XML_ITEMS = "//MI/DL/D", if it's an AD : XML_ITEMS = "//AD/DL/D") I'm working with DocumentBuilder and XPathExpression. Thnx for the h...

How to select following sibling/xml tag using xpath

I have an HTML file (from Newegg) and their HTML is organized like below. All of the data in their specifications table is 'desc' while the titles of each section are in 'name.' Below are two examples of data from Newegg pages. <tr> <td class="name">Brand</td> <td class="desc">Intel</td> </tr> <tr> <td class="name">Series</...

escape colon in Xpath search

Hi, I'm using Hpricot with selenium I have this html input element: <input id="foo:bar"/> And I'm trying to get this value with this Xpath expression: source = Hpricot(@selenium.get_html_source) source.search("//input[@id='foo:bar']") but it is not finding anything because of the colon. I have seen that the Xpath expression cannot...

XSLT: Finding last occurance in a string

Given a form number like: ABC_12345_Q-10 I want to end up with: ABC12345 So I need to find the position of the second underscore Note that there is not a standard pattern or length to any of the "sections" between the underscores (so I cannot use substring to simply eliminate the last section). xPath 2.0 solutions ok ...

Determine if one XPath expression implies another

How can I programmatically determine if XPath expression A always will match something when XPath expression B matches something, in other words that B implies A? By "matching something" I mean that the result is a non-empty set of nodes, so this is boolean XPath matching. Examples: /Fruits/Apples implies /Fruits /Fruits implies /Fru...

to select a submenu item using an xpath

Hi there, I'm trying to select a sub-menu item using XPATH. The submenu items have the following structure in common. ..../span/a[@class="button"] Inside the anchor tag, the title of button is present inside a <strong/> tag e.g. <span> <a class="button" text="" href="....."> <strong> submenu item 1 </strong> </a> </span> How do ...

How to get the xpath of a certain node when viewing an xml file in Visual Studio?

When I open an xml file in Visual Studio and browse it, I want to get the xpath of a certain node at the cursor like right click and choose "get xpath from this node" or something like that. How can we do that in Visual Studio 2010 or which tools/addons to use to do that? Hope to hear from you all. ...

detecting nodes in xml

for example, we have this xml: <p>[TAG] <span>foo 1</span> <span>foo 2</span> [/TAG] <span>bar 1</span> <span>bar 2</span> </p> how can i detect <span>-tags between words [TAG] and [/TAG] ("foo 1" and "foo 2" in this case)? UPD. for example i need to change nodeValue of each span between [TAG] and [/TAG] ...

assertion with Xpath

Hello, I'm trying to assert SOAP response by using Xpath to select particular nodes, here is my XML response <return> <contactList> <contacts> <person> <contactId>3426</contactId> <personName> <names> <firstNa...

How to parse Gmail chat logs from webpage?

What would be the best way to parse Gmail chat logs from the webpage where it's displayed? As far as I know, this is still the only way to access server-hosted Gmail chat logs (through either desktop Gmail or mobile Gmail). When looking at the generated source where the conversation takes place, the markup looks like nested divs and sp...

Selenium IDE - How to record xpath in the Firefox plugin

Hi All! I'm having trouble with my xpaths in the Firefox plugin. I have three textboxes, the first one has ID=login and the rest has dynamically generated IDs. The first one works fine to write in the plugin, //input[@id='login'] but as soon as I try something more advanced, it cannot find anything. After reading plenty of forum posts, ...

XPath Text Search/Sibling Selection

This question might be a little specific but the test program im writing uses XPath to find the data i need in HTML. This piece of HTML(found here) is what im trying to parse. <table border="0" cellspacing="0" cellpadding="0"> <tr> <td class="textSm" align="right">1.&nbsp;</td> <!-- Location of the number is here --> ...

Extracting Nodes from multiple xml files

Hi there, I have three xml files of similar structure and I would like to use an xpath-expression to extract all matching nodes in these files and write them to a thrid one. Do you know a good tool to handle this? I am thinking of something like $supermagicxpathtool -x "//whoopdee" file1.xml file2.xml file3.xml > resultfile.xml ...

asking for a XPath query string

How to parse the "File" node under "File and Folder Items" using Xpath <TreeView> - <Node> Catalog - <Node> Device Items <Node>A1</Node> <Node>A2</Node> </Node> - <Node> File and Folder Items <Node>File</Node> <-- here!!! <Node>Folder</Node> </Node> <Node>CCC</Node> </Node> </TreeView> ...

Need help selecting the second child node and it's children with XPath in C#.

I'm trying to select the second child node off the root and all it's children from XML that looks similar to this: <root> <SET> <element> <element> </SET> <SET> <element> <element> </SET> <root> I'm after all the tags in the second node, any help would be greatly appreciated! I'm using C#. I tri...