xpath

XPath query how to get value of one attribute based on two attribute

I want to extract name attribute value from the following tag <application comments="Do not erase this one" executable="run_CIET" icon="default" instances="1" mode="1" name="CIET" order="10" selection="1" tool="y" /> I can easily get value of name attribute value based on mode value as shown below ...

XPath select innertext

I have this HTML/XML: \t\t\t\t\t \r\n\t\t <a href="/test.aspx"> <span class=test> <b>blabla</b> </span> </a> <br/> this is the text I want <br/> <span class="test"> <b>code: 123</b> </span> <br/> <span class="test"></span> \t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t In C#4 I use the HtmlAgilityPack lib to select the Node with XPat...

How can I use xpath querying using R's XML library?

The xml file has this snippet: <?xml version="1.0"?> <PC-AssayContainer xmlns="http://www.ncbi.nlm.nih.gov" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="http://www.ncbi.nlm.nih.gov ftp://ftp.ncbi.nlm.nih.gov/pubchem/specifications/pubchem.xsd" > .... <PC-AnnotatedXRef> <PC-AnnotatedXRef_x...

Conditional XPath matching

I have some xml that looks like this... <tbody> <tr> <td> <h5> <a class="foo" name="bar">This is the element I want to condition on.</a> </h5> </td> </tr> <tr> <td> <a href="/generic/generic">This is the element I want to match on</a> <td> <td></td> ...

how to load multiple xml files with saxon

I want to use saxon for xpath queries but i don't know to load multiple xml files. I'm trying to use saxon with command line from windows I read in saxon manual that i can use the command: Query.exe -s:myDataFile.xml -q:myQueryFile -o:myOutputFile but i don't know how to load multiple xml files and not just one edit: I have many...

Xpath to select commented code

Hi I have this xpath query: descendant-or-self::link and this html code: <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="stylesheet" type="text/css" href="css/elements.css"> <title>Page</ti...

Parsing xml file using xpath and xquery

I have a xml file <category> <type name="SWEATERS"> <product id =1> <itemNumber>1</itemNumber> <name>ProductA2</name> <price>345</price> </product> <product id=2> <itemNumber>4</itemNumber> <name>Product Test </name> <price>456</price> ...

Create a new XMLDocument by filtering an existing document in c# using xpath

Hi I have a situation where I receive an XML (document) file from an external company. I need to filter the document to remove all data I am not interested in. The file is about 500KB but will be requested very often. let say the following file: <dvdlist> <dvd> <title>title 1</title> <director>directory 2</director> <p...

Searching an HTML document in PHP

Hi there, I'm trying to use DOMDocument and XPath to search an HTML document using PHP. I want to search by a number such as '022222', and it should return the value of the corresponding h2 tag. Any thoughts on how this would be done? The HTML document can be found at http://pastie.org/1211369 ...

Retrieve Control/select value with XPath in SharePoint

A form is populated from a list and I need it filtered. I have a table with a date column and would like to display only the rows of the required month. For this I have used XPath filtering: [((ddwrt:FormatDateTime(string(@MyDateColumn) ,1061 ,'MM'))=02)] This gives me the results for February, all ok. Now what I am trying to achieve ...

Parsing xml file using xpath and xquery

I have a xml file <category> <type name="SWEATERS"> <product id =1> <itemNumber>1</itemNumber> <name>ProductA2</name> <price>345</price> </product> </type> <type name="PANTS"> <product id=2> <itemNumber>4</itemNumber> <name>Product Test </name>...

How do I select nodes that DO NOT have a particular child node?

A rather simple problem... XML Fragment: <bean id='Juicer'> <property name="electric"> <value>false</value> </property> </bean> <bean id='Oven'> <property name="electric"> <value>true</value> </property> <property name="wattage"> <value>1000</value> </property> </bean> I'm trying to wri...

grabbing text between two elements in nokogiri?

<body> <div>some text</div> I NEED THIS TEXT ONLY <div>some text</div> more text here <div>some text</div> one more text here <div>some text</div> </body> How? ...

XPath Find items

How can I return all the 'make' items from the xml document using an xpath query <vehicles> <car> <make>Benz</make> <make>Nissan</make> </car> <motorbike> <make>Honda</make> </motorbike> ...

How to retrieve children of an xml data?

Hello, I have some xml data in the format below - <xyz:reqResponse xmlns:xyz="http://www.test.com/xyz/" xmlns:akt="http://www.exmple.com/akt/"&gt; <xyz:version>1.2</xyz:version> <xyz:totalRecords>659</xyz:totalRecords> <xyz:records> <xyz:record> <doc> <str name="icon_url">http://www.icons.net/ico...

How to create html list from flat xml file using XSLT.

Okay guys I think this is a tricky one... I am looking for a clean way to do the following using XSLT: Convert this source: <para>blah blah</para> <list>num1</list> <list>num2</list> <list>num3</list> <para>blah blah</para> <list>num1</list> <list>num2</list> <para>blah blah blah blah blah</para> To this output: <p>blah blah</p> <o...

XPath query with descendant and descendant text() predicates

I would like to construct an XPath query that will return a "div" or "table" element, so long as it has a descendant containing the text "abc". The one caveat is that it can not have any div or table descendants. <div> <table> <form> <div> <span> <p>abcdefg</p> </span> </div> <table> ...

How to select all leaf nodes using XPath expression?

I believe it's possible but couldn't figure out the syntax. Something like this: xmlNode.SelectNodes("//*[count(child::*) <= 1]") but this is not correct. ...

Using XPath to filter HTML by class value

I'm fetching an a HTML page and try to get some of it's content to show it in a table view. Following the documentation I tried NSXMLDocument and NSXmlParser but could not get any of them to give me the right data back :-( The page I'm trying to scrap is http://www.instapaper.com/u The code I'm using is NSXMLDocument * doc = [[NSXMLDo...

xpath expression from xml with namespace prefix

Hi, I could not get the following xpath expression to work when the xml path namespace prefix set. /bk:BookStore/bk:Books/bk:Book[text()='Time Machine'] XML is: <bk:BookStore xmlns:bk="http://www.bookstore.com/book#"&gt; <bk:Books> <bk:Book id="1">Time Machine</bk:Book> </bk:Books> </bk:BookStore> ...