xpath

XSL: How best to store a node in a variable and then us it in future xpath expressions?

I need to be able to store a node set in variable and then perform more filting/sorting on it afterward. All the examples I've seen of this involve either using XSL2 or extensions neither of which are really an option. I've a list of hotels in my XML doc that can be sorted/filtered and then paged through 5 at a time. I'm finding though ...

how to retrieve corresponding xpath

I would like to know about how to retrieve corresponding xpaths when we input an xml file in java with eclipse platform. For example, <document> <name>xml file</name> <size>12 kb</size> </document> the result is: /document /document/name /document/size ...

filter xml based on query string

I want to filter xml based on query string my xml is like this <Categories> <Category> <Title>Food1<Title> <Cat>Cat3</Cat> <Duration>12/1/2009-12/1/2011</Duration> <Description>Who is hungry</Description> <Category> <Category> <Title>Food1<Title> <Cat>Cat2<...

Converting a simple XPath query to an E4X query

One might think the corresponding E4X query for the XPath query, //*[@foo = "bar"], would be ..*.(@foo == "bar"), but that will throw an error whenever it gets to an element without a foo attribute. I am currently using ..*.(function::valueOf().@foo == "bar") instead. My question is if there is another, less of a hack-way to do this. ...

Flatten XML using multiple XPath expressions

I'm looking for a generic algorithm which can flatten a XML file into a table, given multiple XPath expressions and all things i've tried failed due to the nature of available XPath engines implementations. Given a XML: <A Name="NameA"> <B Name="NameB1"> <C Name="NameC1"/> <C Name="NameC2"/> <C Name="NameC3"/> </B> <B Name="NameB2">...

edit in place using xpath

Hello. Is it possible to do in place edit of XML document using xpath ? I'd prefer any python solution but Java would be fine too. ...

Check Empty XML data validation before displaying

I want to check xml before displaying it .I am using XPath not xsl for it. For e.g. <title></title> <url></url> <submit></submit> i wanna check that if xml data is not there for it . Then don't display it. because I m putting these values in <a href=<%#container.dataitem,url%>>new link</a>. So i want that if url is empty then don't d...

XPath: How do you do a lowercase call in xpath

I'm using Firefox's XPath-checker and can't get the syntax right. I have a link: <a>LinkName</a> and I try doing: //a[lower-case(child::text())='linkname'] but I have a syntax error. What am I doing wrong? Thanks ...

problem in sort by date---> xml

Hi, I have a xml and I want to sort it by date.my code till now is this XmlDocument doc = new XmlDocument(); doc.Load("/ABC.xml"); XPathNavigator nav = doc.CreateNavigator(); //doing some filtering and creating xpath expression based on that XPathExpression expression = nav.Compile(xpath); XPathExpression sorte...

Limit to number of items returned from DOMXPath query?

I'm having an issue where I am trying to pull 1700+ anchors off a webpage using a DOMXPath query. However the DOM Node List length is returned as 1400. I have done the same (with added tbody's) in XPather in FF and it returns 1700+ anchors so I know the query is right. Is there a limit to how many nodes xpather can return? Or how muc...

xPath/HTML: Select node based on related node

<html> <body> <table> <tr> <th>HeaderA</th> <th>HeaderB</th> <th>HeaderC</th> <th>HeaderD</th> </tr> <tr> <td>ContentA</td> <td>ContentB</td> <td>ContentC</td> <td...

Jquery/Xpath for XAML

Is there project that could have like '$' shortcut, to use css-like or xpath possibility. Especially with dynamic keyword. ...

XPath concat multilpe nodes

Hi, I'm not very familiar with xpath. But I was working with xpath expressions and setting them in a database. Actually it's just the BAM tool for biztalk. Anyway, I have an xml which could look like: <File> <Element1>element1<Element1> <Element2>element2<Element2> <Element3> <SubElement>sub1</SubElement> <SubElement>sub2...

Please check my XPath query.

please tell me where is problem. i wrote this xpath query but its not retriveing me any node. i want to select "HotelName" from it:- my selector code: Dim xmlPath As String = Server.MapPath("aa.xml") Dim doc As XmlDocument = New XmlDocument() doc.Load(xmlPath) Dim nodeList As XmlNodeList = doc.DocumentElement.SelectNodes("//HotelIn...

Is there a way to find innermost nodes recursively from xml using c# or vb

I have an XML file say <items> <item1> <piece>1300</piece> <itemc>665583</itemc> </item1> <item2> <piece>100</piece> <itemc>665584</itemc> </item2> </items> I am trying to write a c# application to get all the x-path to inner most nodes eg : items/item1/piece items/item1...

Removing the <script> elements of an HTML

Hi, I'm using Ruby, with the Nokogiri module, and i want to get the content of the body without the script elements. Nokogiri parse uses XPATH or CSS 3.0. XPATH i really dont understand, and i can't find the CSS selector to achieve my goals. ...

Using XPath, How do I select a node based on its text content and value of an attribute?

Given this XML: <DocText> <WithQuads> <Page pageNumber="3"> <Word> July <Quad> <P1 X="84" Y="711.25" /> <P2 X="102.062" Y="711.25" /> <P3 X="102.062" Y="723.658" /> <P4 X="84.0" Y="723.658" /> </Quad> </Word> <...

count function in xpath

I have got an XML document and trying to get the number of nodes that have a particular text using xpath. see xml below count(//event_type) returns the number of event_type nodes but what I want is the number of event_type nodes that have the Error text. <Response> <run_id>20091231-105000</run_id> <message> <timestamp>2...

Updating onclick's string value with Greasemonkey

I'm trying to write a Greasemonkey script to update the onclick value of a bunch of links on a page. The HTML looks like this: <a onclick="OpenGenericPopup('url-99.asp','popup',500,500,false)" href="javascript:void(0)">text</a> I need to update the url-99.asp part of the Javascript into something like urlB-99.asp. In my script, I'm...

XPath to get Unique Element Names

I want to use XPath to get a list of the names of all the elements that appear in an XML file. However, I don't want any names repeated, so an element with the same name as a preceding element should not be matched. So far, I've got: *[not(local-name() = local-name(preceding::*))] This executes alright but it spits out duplicates. Why...