Using DOMXPath::query is it possible to get just one level deep of childNodes?
For example if I had a document like:
<div>
<span>
<cite>
</cite>
</span>
<span>
<cite>
</cite>
</span>
</div>
I would want the NodeList to contain just the spans and not the cites.
Should also mention that ...
Hello,
Is there a way to find an element's XPath using IE Developer Tool?
Thanks,
Teddy
...
What tools are you guys using for XPath and why?
Right now I'm using
SketchPath because its totally awesome, but its a windows app that needs to be installed
WhiteBeam online XPath test bedbecause you can test expressions from the website
SketchPath seems to stand out the most to me because it actually helps you create the xpath and ...
Is it possible to select an h1 tag that does not contain any img tags with a single line XPath expression? If so, what is it?
...
This might sound a bit complicated, but what I want to do is find all <a>s that contain <img>s such that the images that are in the same node with the greatest number of other images are chosen first.
For example, if my page looks like this:
If the blue squares are <div>s and the pink squares are <img>s then the middle div contains t...
I'm trying to extract an element with a particular innertext from a parsed XML document. I know that I can select an element that has a child with a particular innertext using //myparent[mychild='foo'], but I actually just want to select the "mychild" element in this example.
<myparent>
<mychild>
foo
</mychild>
</myparent>
What would...
I'm using the xpath engine on Firefox. I have html:
<span>
<b>prefix one</b> not bold part
</span>
<span>
prefix two not bold part
</span>
I want all the spans that have child text that start with "prefix one".
I tried the xpath:
//span[starts-with(child::text(), "prefix one")]
but this doesn't work because the b tag is inte...
Assuming I have a XML like so:
<a>
<b>
<i>data</i>
<ii>data</ii>
<iii>data</iii>
</b>
<b>
<i>data<i>
<ii>data<ii>
<iii>data</iii>
</b>
</a>
Using XPath, how would I select the above XML to create a structure like so:
<b>
<i>data</i>
<ii>data</ii>
</b>
<b>
<i>data<i>
<ii>data<ii>
...
I have the following kind of HTML. The content is grouped by the <div "id=foo"> and <div "id=foo1"> elements, with <div "style=padding…"> in-between.
I'm trying to figure out how to craft an XPath expression that will allow me to trigger off the "id=foo" to return the sibling <div>s with "style=padding…"
Getting the <div id="foo"> is t...
I have a somewhat large file (~500KiB) with a lot of small elements (~3000). I want to pick one element out of this and parse it to a java class.
Attributes Simplified
<xml>
<attributes>
<attribute>
<id>4</id>
<name>Test</id>
</attribute>
<attribute>
<id>5</id>
<name>Test2</name>
</attribute>
<!--3000...
Which XPath 2.0 libraries (apart from saxon) are available, preferably for .Net?
...
My first question here, would be awesome to find an answer. I am new to using nokogiri.
Here is my problem. I have something like this in the HTML head on a target site (here a techcrunch post):
<meta content="During my time at TechCrunch I've seen thousands of startups and written about hundreds of them. I sure as hell don't know all ...
I want to get the xpath count of all the divs/links/.. that have text matching some regular expression. For example:
<span> day 2 night </span>
<span> day 4 night </span>
<span> day 17 night</span>
I would like to be able to call:
sel.get_xpath_count('regexp:day \d night')
and have it return 2. (This is a simple example of course, ...
page.getByXPath("//*[@href='http://www.example.com/index.do/abc/1_*'");
Do I need to escape any characters?
I am trying to get all ahref links on the page that have the pattern of:
http://www.example.com/index.do/abc/1_
so these should all be retrieved:
http://www.example.com/index.do/abc/1_asdf-asdfasdf
http://www.example.com/ind...
Following Question:
<div id="id-74385" class="guest clearfix" style="z-index: 999;">
Given above,
If I want a xpath with checks both id and class, can we do it w/ 'and' condition LIKE:
//div[@id='id-74385'] and div[@class='guest clearfix']
Is this correct way? My execution fails here... Please help!
...
Hi, everyone.
About a year ago I wrote a jQuery-inspired library which allowed you to manipulate the DOM using PHP's XPath and DOMDocument. I recently wanted to clean it up and post it as an open source project. I've been spending the past few days making improvements and implementing some more of PHP's native OO features.
Anyhow, I th...
In my answer to another post in SO (here: http://stackoverflow.com/questions/1948552/sharepoint-2007-how-to-check-if-a-folder-exists-in-a-document-library/2005855#2005855) I had to parse an XML document with structure:
D:multistatus
|--D:response
|----D:propstat
|-------D:prop
|----------D:displayname
|----------D:isFolder
Is it possi...
Hi,
I have a Dataset and want to display the containing rows in a WPF-Contorl. The problem is, that the control is sort of a circuit diagram. Thus I created a template to show the values and placed multiple instances of it in my circuit control. Currently the XAML-code in the circuit looks like this:
<Label Content="{Binding Path=.[0]}"...
I have a html table like:
<table ..... class="cars">
<tr class="item-odd">
...
</tr>
<tr class="item-even">
</tr>
</table>
How could I get the table rows using xpath?
//tr[contains(@class, ???)
can I use OR in there somehow to say item-odd|item-even
...
If I have HTML that looks like:
<td class="blah">&nbs;<a href="http://.....">????</a>&nbsp;</td>
Could I get the ???? value using xpath?
What would it look like?
...