Is it possible to get/generate the XPath, for a text selected in the HTML page. Say,I have opened an html file using a browser,say safari/firefox, now i select some text (using mouse), i want to generate/get the xpath for that. is it possible to get it programatically? how?
...
click
//div[15]/div/ul/li[5]
In the snippet above, how can I write xpath or css selector based on known li item. Yes, I know li item ahead of time(such as @, +, * etc ) Also there is no guarantee that div[15] would be always div[15] it could be div[14] or div[17] etc
...
How to find the depth of the xml file using powershell/xpath?
consider the below xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<bookstore>
<book>
<title>Harry Potter</title>
<price>25.99</price>
</book>
<book>
<title>Learning XML</title>
<price>49.95</price>
</book>
</bookstore>
depth of the above xml document is 3 (bookst...
This is an example xml from MSDN
<?xml version="1.0"?>
<!-- A fragment of a book store inventory database -->
<bookstore xmlns:bk="urn:samples">
<book genre="novel" publicationdate="1997" bk:ISBN="1-861001-57-8">
<title>Pride And Prejudice</title>
</book>
<book genre="novel" publicationdate="1992" bk:ISBN="1-861002-30-1">
...
Hi!
Is there a generic way of determining all attributes (and their values) from an XML node using XQuery/XPath?
thx, Alex
...
I need an xpath expression that would return the value of I need to get the value of this node. the value to extract is my xpath expression is
//rates/rate[loantype='30-Year Fixed Rate'] The issue hre is that there are three value each node has a subtype element. Beside fileter for loantype I also need to filter for subtype. I am...
I'm trying to iterate over some elements in an XML document that may be nested, but as I iterate over them I may be removing some from the tree. I'm thinking the best way is to do this recursively, so I'm trying to come up with an XPath Query that will select all the top-level nodes relative to the current node. //foo[not(ancestor::foo)]...
I am parsing the tabular information from the html file with the help of the html agility pack.
Now I can do it and it works.
But when the table what I want to extract is inner most.
Or I don't know at which position it is in nested tables.And there can be any number of nested tables and from that I want to extract the information o...
I would like to select all elements that have certain attribute or don't have it at all:
//job[@salary<"100" or !@salary]
This code is not valid. Which one is? Thanks!
...
I have XML like,
<items>
<item>
<products>
<product>laptop</product>
<product>charger</product>
<product>Cam</product>
</products>
</item>
<item>
<products>
<product>laptop</product>
<product>headphones</product>
<product>Photoframe</product>
</products>
</item...
Hello,
I have a malformed page to scrape, and have had a hard time getting the correct XPath for YQL. I can scrape individual fields that I need using, for example:
//*[@id="cell_12345"]
But what I really need to do is return all elements who's ID begins with cell_. Something like:
//*[@id="cell_"*]
How do I do this?
Also, if any...
Hi,
If I have XML tree like this-
<Parent>
<Image Name="a"/>
<Image Name="b"/>
<Child>
<Image Name="c"/>
<Image Name="d"/>
</Child>
<SomeElem>
<Image Name="h"/>
<Image Name="g"/>
</SomeElem>
<Image Name="e"/>
</Parent>
I want to select all <Image\> nodes except those listed inside <Child\> node.
Currently I am using que...
Hi all. I am trying to use html5lib to parse an html page in to something I can query with xpath. html5lib has close to zero documentation and I've spent too much time trying to figure this problem out. Ultimate goal is to pull out the second row of a table:
<html>
<table>
<tr><td>Header</td></tr>
<tr><td>Want This</...
I'm building a tool that performs xpath 1.0 queries on XHTML documents. The requirement to use a namespace prefix in the query is killing me. The query looks like this:
html/body/div[@class='contents']/div[@class='body']/
div[@class='pgdbbyauthor']/h2[a[@name][starts-with(.,'Quick')]]/
following-sibling::ul[1]/li/a
(all on o...
I'm working with an OpenXML document, processing the main document part with some XSLT.
I've selected a set of nodes via
<xsl:template match="w:sdt">
</xsl:template>
In most cases, I simply need to replace that matched node with something else, and that works fine.
BUT, in some cases, I need to replace not the w:sdt node that matche...
Im having a big xml tree with a simple structure. All I want to do is get a node by its attribute using xpath and loop the children.
param1 - correct language
param1 & param3 - correct node by its id and the parents id. (Need to use parent id when multiplie id appears. The id is not declared as id in DTD)
public function getSubme...
<input type="Checkbox" checked="" name="new">
if I have the above html in a document, how would I find it by searching for its name attribute?
Edit 1: Clarified that I was looking for a solution using Nokogiri
...
I am trying to use YQL to extract a portion of HTML from a series of web pages. The pages themselves have slightly different structure (so a Yahoo Pipes "Fetch Page" with its "Cut content" feature does not work well) but the fragment I am interested in always has the same class attribute.
If I have an HTML page like this:
<html>
<bo...
Hello,
What I'm trying to do is fairly simple, but I can't find the way to. I just want to iterate over the children of a node excluding the first child.
For instance, in this XML snippet, I would want all the <bar> elements, except the first one:
<foo>
<Bar>Example</Bar>
<Bar>This is an example</Bar>
<Bar>Another example<...
My code doesn't return the node
XmlDocument xml = new XmlDocument();
xml.InnerXml = text;
XmlNode node_ = xml.SelectSingleNode(node);
return node_.InnerText; // node_ = null !
I'm pretty sure my XML and Xpath are correct.
My Xpath : /ItemLookupResponse/OperationRequest/RequestId
My XML :
<?xml version="1.0"?>
<ItemLookupRespons...