xpath

Xpath how to select an element based on an order and dependent of its existence

Hi, how to select an element based on an order and dependent of its existence in XPath ? For example how to select the best quality video if it exist. <VIDEOS> <LOW_RES>video_L.flv</LOW_RES> <HI_RES>video_H.flv</HI_RES> <HD/> </VIDEOS> this should return video_H.flv because the hd version doesn't exist this case can exist...

Get a single element with PHP and XPath

Lots of tutorials around the net but none of them can explain me this: How do I select a single element (in a table, for example), having its absolute XPath? Example: I have this: /html/body/table/tbody/tr[2]/td[2]/table/tbody/tr/td/table[3]/tbody/tr/td/table/tbody/tr[3]/td/table/tbody/tr[4]/td[5]/span What's that PHP function to ge...

What will this xpath query select?

Hi, I have the following xpath query which seems to be working but I just want to be sure its not incorrect: //link[@type='application/rss+xml' or @type='application/atom+xml' and @rel='alternate'] The purpose is to do feed autodiscovery from a web page. What I want it to do is: all link tags with either (rss or atom) and rel alter...

xforms "instance namespace" issue

I am creating an Xform that reads an XML document and creates an input form for updating the document. However, apparently due to a namespace issue none of my Xpath expressions resolve.My form works fine on a simple instance when the instance file has no namespace. However, I need the namespace support. My instance file has a namespace ...

Nant xmlpoke and unique nodes

I am trying to use an xmlpoke task to update a VS Project File (which is XML). In the Project root, there are multiple PropertyGroup nodes, I am trying to select the first one. The XML looks like this <Project> <PropertyGroup> </PropertyGroup> <PropertyGroup> </PropertyGroup> <PropertyGroup> </PropertyGroup> ...

XPath query returning 'false' in SimpleXML

Hi all, I have an xml fragment as such: <meta_tree type="root"> <meta_data> <meta_cat>Content Provider</meta_cat> <data>Mammoth</data> </meta_data> <meta_data> <meta_cat>Genre</meta_cat> <data>Games</data> </meta_data> <meta_data> <meta_cat>Channel Name</meta_cat> <dat...

C# XPath Not Finding Anything

I'm trying to use XPath to select the items which have a facet with Location values, but currently my attempts even to just select all items fail: The system happily reports that it found 0 items, then returns (instead the nodes should be processed by a foreach loop). I'd appreciate help either making my original query or just getting XP...

Improve XPath efficiency for repeated, parameterized queries / Xalan selectSingleNode() method

Hi, I am repeatedly performing the following XPath query (though parameterized by 'keywordText') around 40,000 times: String query = SystemGlobal.YAHOO_KEYWORDSSUBNODE + "/" + SystemGlobal.YAHOO_KEYWORDNODE + "[" + SystemGlobal.YAHOO_ATTRKEYPHRASE + "='" + keywordText + "']"; CachedXPathAPI cachedXPathAPI = new CachedXPathAPI(); NodeIt...

Select Comment with xPath by Comment-Text

Hi How can I select the next node after an defined comment? I know the text of the comment and need the next nodes. Best regards Christoph ...

Trying to create XPath from this HTML snippet

I have played for a while writing XPath but am unable to come up with exactly what I want. I'm trying to write XPath for link(click1 and click2 in code snippet below) based on known text(myidentity in code snippet below). Can someone take a look into and suggest possible solution? HTML code snippet: <div class="abc"> <a onclick="myc...

Parsing Web Service Response in Oracle 9i

I'm having trouble parsing an XML response from a web service. I have a feeling this is due to a namespace issue. But, after 4 hours of research, trial-and-error, and head-banging I haven't been able to resolve it. Please help. My goal is to get a dbms_xmldom.DOMNodeList that contains "ERRORS" nodes. XML Response: <?xml version="1....

T-SQL XML Query, how to seperate matching nodes into individual rows?

I have a table that has a column full of XML like: <parent> <child> <name>Sally</name> </child> <child> <name>Bobby</name> </child> </parent> I'm trying to extract all of the names of the children into seperate rows. My desired resultset would look like: Sally Bobby However, if I do something like: SE...

Select on multiple criteria with XPath

I have an XML document which looks something like this: <meadinkent> <record> <comp_div>MENSWEAR</comp_div> <sty_ret_type>ACCESSORIES</sty_ret_type> <sty_pdt_type>BELTS</sty_pdt_type> <pdt_category>AWESOME_BELTS</pdt_category> </record> <medinkent> I want to useXPath to select nodes which match all four elements and I'm...

XML transform element appearing in wrong place in document

I am having some problems with an XML transform and need some help. The stylesheet should iterate through all suffix elements and place the contents without the suffix tag next to the last text node within its first ancestor quote-block element (see desired ouput). It works when only a single suffix is present, but not when 2 are prese...

how to COPY Attribute value in a new attribute

How to copy data of attribute to new attribute in the same column in sql original data <root> <child attr='hello'></child> </root> Result 1 <root> <child attr='hello' attr2='hello'></child> </root> Result 2(with a modification) <root> <child attr='hello' attr2='**H**ello **W**orld'></child> </root> I want to do this only throu...

Find position of a node within a nodeset using xpath

After playing around with position() in vain I was googling around for a solution and arrived at this older stackoverflow question which almost describes my problem. The difference is that the nodeset I want the position within is dynamic, rather than a contiguous section of the document. To illustrate I'll modify the example from the ...

How can I get JDOM/XPath to ignore namespaces?

I need to process an XML DOM, preferably with JDOM, where I can do XPath search on nodes. I know the node names or paths, but I want to ignore namespaces completely because sometimes the document comes with namespaces, sometimes without, and I can't rely on specific values. Is that possible? How? ...

Problems in selecting a node in XML with Namespace using XPATH

I have the following XPATH line: //det[@nItem="1"]/prod/cProd That successfully selects the desired node using XPath Visualizer, where it identifies automatically the namespace, and you define in which namespace you want to select. When I specify the namespace in C# with the following XPATH code: "http://www.portalfiscal.inf.br/n...

XPath - is it possible to query the node content?

I've this xml <root> <node1> <node2>xxx</node2> </node1> ... <node1> <node2>yyy ABC yyy</node2> </node1> ... <node1> <node2>zzz</node2> </node1> </root> I want to get node1 that has a node2 containing the text ABC. Is it possible to achieve this using XPath? ...

php xpath query on and xpath result

Can I use an xpath query on a result already obtained using xpath? ...