I am reformatting an HTML document using the Agility Pack, and I've run into a limitation of my understanding of XPath.
In the document I'm working with, the following is a common construct:
1282
Which is built like this:
128<img src="" style="display: none;" alt="^(" /><sup>2</sup><img src="" style="display: none;" alt=")" />
...
In my Oracle db I have records like this one:
<ROOT>
<Event>
<Type>sldkfvjhkljh</Type>
<ID>591252</ID>
</Event>
<Data>
<File>
<Name>1418688.pdf</Name>
<URL>/591252/1418688.pdf</URL>
</File>
<File>
<Name>1418688.xml</Name>
<URL>/591252/1418688.xml</URL>
</File>
</Data>
</ROOT>
I n...
The overall goal is to remove all empty nodes--including nodes which would be made empty if the child empty nodes were removed. The following:
<xsl:template match="*[not(node())]"/>
will remove empty nodes, but will leave empty nodes that had only empty nodes in them previously. I think I need an xpath that will match all nodes that a...
Hi!
In Xpath, I am wanting to select elements that equal a specific value.
Sample XML data:
<aaa id="11" >
<aaa id="21" >
<aaa id="31" ></aaa>
<bbb id="32" >
<aaa id="41" ></aaa>
<bbb id="42" ></bbb>
<ccc id="43" ></ccc>
<ddd id="44" >qwerty</ddd>
<ddd id=...
EDIT: Why was this voted down? I really have no idea... BTW ../ does not work since i don't want the parent of the Table but want actually ../td+1 i don't know if that is even possible?
Hi guys.
I have a fairly complex problem at hand..
I have a table like this:
Name | Result | AutotestID | AutotestResult | AutotestName
X | Pass |...
I want to use XPath to filter information from an XML.
XPathFactory factory = XPathFactory.newInstance();
XPath xpath = factory.newXPath();
Object result = null;
// set the custom resolver to compares dates
xpath.setXPathFunctionResolver(new DateValidatorContext(PubUtils.getInstance().parseDate(date), operator));
...
So I am writing a mac application that parses SF Giants baseball statistics using xpath. In my situation I have a specific number Identifier of a person <td class="textSm" align="right">1. </td>(in my application a person could search find a stat based on a number input) but from there I need to back out from that spot in the HTML, ...
Hi,
I'm trying to extract all name values in input fields using selenium and perl. Part of the value, enough to identify it, is known, the rest is unknown:
This xpath works in finding all relevant matches:
//tr/td//input[contains(@name,'partofname')]
So, in perl:
my $xpath = qq(//tr/td//input[contains(\@name,'partofname')]);
my $c...
I have the following XML:
<products>
<product>
<name>Flat Panel Monitor</name>
<code>LS123</code>
<attributes>
<attribute>
<group>Color</group>
<values>
<value>Red</value>
<value>Blue</value>
<value>...
Hi There,
I'm trying to write an XSLT transformation which will replace the value in one node with the value of it's preceding sibling. Then return the entire document transformed :)
Find the occurrences of
<package:packageDownloadLocator>http://myunwantedurl</package:packageDownloadLocator>
and replace with the text value of i...
Hello,
Quick question:
I have XML with the following code:
<Experiment>
<mzData version="1.05" accessionNumber="1635">
<description>
<admin>
<sampleName>Fas-induced and control Jurkat T-lymphocytes</sampleName>
<sampleDescription>
<cvParam cvLabel="MeSH" accession="D017209" name="apoptosis" />
<cvParam cvLabel="UNITY" accession="D21...
I want to be able to grab an HTML page and parse it using only Javascript, nothing touches the server.
Assuming I can get the html response (solved the cross-domain issues), how can I use jQuery on the complete html document?
Example is like this (here is a full gist with a remote example):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
Hello, I have some links at the page like:
123test.com/456
abc_test.com/sdfsd
abc_test.org
I have to get all elements which href attribute consists of test word.
I know how to click at such link by given number:
selenium.click("//body/descendant::a[contains(@href,'test')][2]")
This code will click at second link which has 'test' i...
Hiya.
how do I print the an attribute of an element?
example:
$doc = new DOMDocument();
@$doc->loadHTML($page);
$xpath = new DOMXPath($doc);
$arts= $xpath->query("/td");
foreach ($arts as $art) {
here i wanna print the attribute class of the td element, how do i do so ?
}
...
Hi! I try get the content this URL: http://www.chromeball.com, but the character encoding is not good.
I have this code:
$url = 'http://www.chromeball.com';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
$data = curl_exec($ch);
curl_close($ch);
$dom = new DOMDocu...
I'm trying to get just some specific cells in each row using HTMLAgilityPack.
foreach (HtmlNode row in ContentNode.SelectNodes("descendant::tr"))
{
//Do something to first cell
//Do something to second cell
}
There are more cells, and each cell needs some specialized treatment. I guess there's a way to do this using XPath, but...
I have some html that looks pretty much like this.
<p>
<a img src="img src">
<strong>foo</strong>
<strong>bar</strong>
<strong>baz</strong>
<strong>eek</strong>
This is the text I want to select using xpath.
</p>
How can I select only this particular text node as indicated above using xpath?
...
Hiya.
I'm using DomDocument to query for html elements.
when i use $obj->textContent or $obj->nodeValue it returns only the texts that include in the element, it does not return the html representation of the object.
which means..
if the object contains
<div>test</div>
the return value for both tries will be test.
how do i fetch the...
When I run this:
XmlDocument xmlResponse = new XmlDocument();
XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlResponse.NameTable);
nsmgr.AddNamespace("fn", " http://www.w3.org/2005/xpath-functions");
xmlResponse.LoadXml(
"<LIST>" +
"<ITEM NUMBER='3' TEXT='C'/>" +
"<ITEM NUMBER='2' TEXT='B'/>" +
"<I...
META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1" />
TITLE>Microsoft Corporation
META http-equiv="PICS-Label" content="(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0))" />
META NAME="KEYWORDS" CONTENT="products; headlines; downloads; news; Web site; what's new; solutions; services...