xpath

Can I query DOM Document with xpath expression from multiple threads safely?

I plan to use dom4j DOM Document as a static cache in an application where multiples threads can query the document. Taking into the account that the document itself will never change, is it safe to query it from multiple threads? I wrote the following code to test it, but I am not sure that it actually does prove that operation is sa...

need help with xpath expression

I have an xml node that looks like <slot highcount="20" lowcount="10" /> I've tried the following xpath expression: XmlNode node = xdoc.SelectSingleNode("slot[@lowcount>=12] && slot[@highcount <=12]"); but I get an invalid token error and I don't have enough experience with this to know what I'm doing wrong. Any ideas? ...

Using YQL multi-query & XPath to parse HTML, how to escape nested quotes?

The title is more complicated than it has to be, here's the problem query. SELECT * FROM query.multi WHERE queries=" SELECT * FROM html WHERE url='http://www.stumbleupon.com/url/http://www.guildwars2.com' AND xpath='//li[@class=\"listLi\"]/div[@class=\"views\"]/a/span'; SELECT * FROM xml ...

What are good CLI tools for JSON?

General Problem Though I may be diagnosing the root cause of an event, determining how many users it affected, or distilling timing logs in order to assess the performance and throughput impact of a recent code change, my tools stay the same: grep, awk, sed, tr, uniq, sort, zcat, tail, head, join, and split. To glue them all together, U...

XPATH: select subset of xml file

In my case, I have: <booklist> <book id="1"> </book> <book id="2"> </book> <book id="3"> </book> ...... </booklist> How can i just return: <booklist> <book id="1"> </book> </booklist> if I use /booklist/book[@id=1], I can only get <book id="1"> </book> But I also need the document element. Thanks ...

Extracting data from Wikipedia JSON or XML with PHP

I want to use PHP (possibly with Curl/XPath?) to extract data from Wikipedia pages. What would be the best way to go about this? I'll be using CakePHP for this project, although just need to figure out how to get this working first. ...

Use of @ symbol in xslt...

Please explain what is the use of @ symbol in XSLT with example. Cheers! Lokesh Yadav ...

php simplexml xpath question

Hey, I'm very newbie to xPath and time is against me, I don't have the time right now to learn a lot about it, so I hope you guys can help me with this! :) Here is my xml format: <Filme> <Film> <filmid>13497</filmid> <originaltitel>Bird</originaltitel> <originaluntertitel></originaluntertitel> <titel>Bird (OmU)</titel> <unte...

XPath ancestor and descendant in XSL copy-of

hi! I am new to XPath, and from what I have read in some tutorials about axes, I am still left wondering how to implement them. They aren't quite behaving as I had expected. I am particularly interested in using ancestor and descendant axes. I have the following XML structure: <file> <criteria> <root>ROOT</root> <...

using XSL to replace XML nodes with new nodes

I need an XSL solution to replace XML nodes with new nodes. Say I have the following existing XML structure: <root> <criteria> <criterion>AAA</criterion> </criteria> </root> And I want to replace the one criterion node with: <criterion>BBB</criterion> <criterion>CCC</criterion> <criterion>DDD</criterion> So that th...

Help needed wit the XPath statement for Selenium test

I am testing a calendar component using Selenium. In my test I want to click on the current date. Please help me with the XPath statement for doing that. I am adding the HTML for the calendar component. <input id="event_date" type="text" on="click then l:show.event.calendar" style="border: 1px solid rgb(187, 187, 187); width: 100px;" f...

Fast search in XMl files in .NET (or How to index XML files)

I have to implement a search feature which is able to quickly perform arbitrary complex queries to XML-data. If the user makes a query, all XML files must be searched to find possible matches. The users will have lots of XML-Files (a few 10000 or more) which are typically a few kilobytes in size. All the XML-files have almost the same st...

Need help with Xpath methods in javascript (selectSingleNode, selectNodes)

I want to optimize my javascript but I ran into a bit of trouble. I'm using XSLT transformation and the basic idea is to get a part of the XML and subquery it so the calls are faster and less expensive. This is a part of the XML: <suite> <table id="spis" runat="client"> <rows> <row id="spis_1"> ...

How to query an EF model (EDMX document) with XPath.

I'm trying to write a utility that automatically sets the ProviderManifestToken attribute in an EDMX document Schema element, but even my basic XPath is not working. What am I doing wrong? The XML: <?xml version="1.0" encoding="utf-8"?> <edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"&gt; <!-- EF R...

Get content of XML node using c#

Hi all, simple question but I've been dinking around with it for an hour and it's really starting to frustrate me. I have XML that looks like this: <TimelineInfo> <PreTrialEd>Not Started</PreTrialEd> <Ambassador>Problem</Ambassador> <PsychEval>Completed</PsychEval> </TimelineInfo> And all I want to do is use C# to get...

obtaining a unique set with javas xpath

Given the following xml document (assuming more books then actually listed) and using the java implementation of xpath. What expression would I use to find a unique set of author names? <inventory> <book year="2000"> <title>Snow Crash</title> <author>Neal Stephenson</author> <publisher>Spectra</publisher> ...

How to concatenate the contents of all children of a node in XPath?

Is it possible with XPath to get a concatenated view of all of the children of a node? I am looking for something like the JQuery .html() method. For example, if I have the following XML: <h3 class="title"> <span class="content">this</span> <span class="content"> is</span> <span class="content"> some</span> <span class...

test="" on a boolean always returns true

Why does <xsl:if test="<XPATH to boolean value here>"> ... </xsl:if> ALWAYS return true? Since boolean can be 0,1,"false" and "true" by definition, the ONLY way to test for a boolean value is to do string comparison against these. This can't be right. ...

How do I select the shallowest matching elements with XPath?

Let's say I have this document. <a:Root> <a:A> <title><a:B/></title> <a:C> <item><a:D/></item> </a:C> </a:A> </a:Root> And I have an XmlNode set to the <a:A> element. If I say A.SelectNodes( "//a:*", namespaceManager ) I get B, C, and D. But I don't want D because it's nested in another...

Most Lite-Weight XML Parser with XPath and Wide-char Support

I want a lite-weight C++ XML parser/DOM that: Can take UTF-8 as input, and parse into UTF-16. Maybe it does this directly (ideal!), or perhaps it provides a hook for the conversion (such as taking a custom stream object that does the conversion before parsing). Offers some XPath support. I've been looking at RapidXML, the Kranf xmlP...