Hi All,
Ive got a large XML set, which I would like to run some xpath on to make into a much smaller sub-set.
Basically, I have this type of layout:
<root>
<item>
<collection1></collection1>
<collection2></collection2>
<collection3></collection3>
...
<collection55></collection55>
<name>item name</name>
<ti...
I'm using SimpleXML and xpath to read elements from an external UTF-8 XHTML document. I then iteratively echo the output of SimpleXML's asXML() function executed upon each element returned from an xpath selector. But the XML carriage return entity is annoyingly inserted after every line of my code. There aren't any extra characters in th...
XPath can do everything querySelector can do, and more, so when would you ever choose the latter? I haven't seen any speed benchmarks comparing the two, so right now I'm choosing based on syntax conciseness, which seems kind of arbitrary.
Edit: I probably should have stated that I'm writing Greasemonkey scripts for Firefox, so I'm not w...
I'm trying to learn xpath. I looked at the other contains() examples around here, but nothing that uses an AND operator. I can't get this to work:
//ul[@class='featureList' and contains(li, 'Model')]
On:
...
<ul class="featureList">
<li><b>Type:</b> Clip Fan</li><li><b>Feature:</b> Air Moved: 65 ft.
Amps: 1.1
Clip: Grips any...
Hi,
I have an XML that goes like this:
<?xml version="1.0" encoding="utf-8" ?>
<colors>
<color index = "0">#FF0000</color>
<color index = "1">#FF0200</color>
<color index = "2">#FF0300</color>
<color index = "3">#FF0500</color>
[..]
I'm trying to select a node by its index:
XmlDocument ColorTable = new XmlDocument();
ColorT...
Hi,
I am looking into using XSLT to convert an XML based declarative language into pure JavaScript code as its output. The declarative language will be used for describing user interfaces similar to Mozilla XUL. I am fairly new to XSLT, and I am not sure how to properly handle all the attributes that the tags can contain. For instance,...
I know this is a simple question, but I can't figure it out.
Consider the following simple XML document:
<root>
<a></a>
<b></b>
<c></c>
<a></a>
<d></d>
<e></e>
<a></a>
<a></a>
</root>
What's the best way to select the nodes <b> through <e> using XPath?
I'm looking for something like "/root/*[not(a)]" (which does not d...
I am writing an XSLT transformation in which I wish to use the Replace function to do a regex match and replace.
However, Visual Studio 2008 reports that
'replace()' is an unknown XSLT function.
The bit of code itself is:
<xsl:otherwise>
<td style="border: solid 1px black; background-color:#00CC66;">
<xsl:variable...
I have an XPath engine implementation that needs to be tested.
Is there a set of standard conformance tests that we can apply to validate that conforms to the XPath specification (in relation to XSLT).
What would be perfect would be XML documents XPath expression and expected results.
...
Given:
<tr>
<td><a href="http://foo.com">Keyword 1</a></td>
<td><a href="http://bar.com">Keyword 2</a></td>
<td><a href="http://wombat.com">Keyword 3</a></td>
</tr>
<tr>
<td><a href="http://blah.com">Keyword 4</a></td>
<td><a href="http://woof.com">Keyword 5</a></td>
<td><a href="http://miaow.com">Keyword ...
I have a table:
<table>
<tr><td>1</td></tr>
<tr><td>2</td></tr>
<tr><td>3</td></tr>
<tr><td>4</td></tr>
<tr><td>5</td></tr>
<tr><td>6</td></tr>
<tr><td>7</td></tr>
<tr><td>8</td></tr>
<tr><td>9</td></tr>
</table>
I need an XPath to select odd rows, starting on the third row (3, 5, 7, 9, etc.).
...
In XPath it is possible to convert an object to string using the string() function. Now I want to convert the string back to an object.
I do understand it is not possible in some cases (for example for elements), because some information was lost. But it should be possible for simple types, like int or boolean.
I know, for numbers I ca...
Hi, big fan of xpath on .net, and sax in python, but first time using xpath in python.
I have a small script, that uses xpath to select some nodes from a doc, iterates through them, and then ideally uses xpath again to get the relevant data from them. However I can't get that last bit, once I have the xmlNode I cannot get a context from...
Consider this simple XML document. The serialized XML shown here is the result of an XmlSerializer from a complex POCO object whose schema I have no control over.
<My_RootNode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="">
<id root="2.16.840.1.113883.3.51.1.1.1" extension="...
I'm using Html Agility Pack to run xpath queries on a web page. I want to find the rows in a table which contain a certain interesting element. In the example below, I want to fetch the second row.
<table name="important">
<tr>
<td>Stuff I'm NOT interested in</td>
</tr>
<tr>
<td>Stuff I'm interested in</td>
<td><interestingtag/>...
Hey all,
I'm trying to get the plain text from a word document. Specifically, the xpath is giving me trouble. How do you select the tags? Here's the code I have.
public static string TextDump(Package package)
{
StringBuilder builder = new StringBuilder();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(package.GetP...
I have this kind of node in my xml document:
<parent ...>
<a .../>
<b .../>
</parent>
Parent node can have both a and b, only a, only b, or none of them. I want to write a XPath to get all parents that have both. Can I do that?
Parent can have also other children.
...
Hey all,
Simple question, I just want to select the text from the <Template> tag. Here's what I have, but the Xpath doesn't match anything.
public static void TestXPath()
{
string xmlText = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
xmlText += "<Properties xmlns=\"http://schemas.openxmlformats.org/officeD...
I'm working on Open XML document format for excel sheets.
var nodeList = WorksheetXml.SelectNodes(@"//c[child::f]");
it should return all rows with formulas, but it doesn't return anything. The same xml on Oxygen Editor, when applied the same xpath expression, returns all of them.
I am copying WorksheetXml inner xml to assure the con...
What is the XPath to find only ONE node (whichever) having a certain attribute (actually I'm interested in the attribute, not the node). For example, in my XML, I have several tags having a lang attribute. I know all of them must have the same value. I just want to get any of them.
Right now, I do this : //*[1][@lang]/@lang, but it seem...