Is there an xpath way to find a node that has a given attribute whose value contains a given string?
For example I have an xml document and want to find a node where the address attribute contains the string Downing, so that I could find the following node:
<person name="blair" address="10 Downing St. London"/>
...
When I worked mostly in Windows, I used Stylus Studio to test out XPath on my XML files. Now that I primarily use OS X, I haven't found an equivalent tool.
What tools for OS X do you recommend for XPath work?
...
Let's say I have the following XML file
<a id="123">
<b type="foo" value="1" />
<b type="baz" value="1" />
</a>
<a id="789">
<b type="bar" value="12" />
</a>
<a id="999">
<b type="foo", value="2" />
</a>
I want to get a list of all the 'a' nodes that have a 'b' subnode with a type="foo" and value="1". You can do something s...
I've not used XML too much and I need a little help.
My .NET application gets this XML response from the W3C's public validation server:
<?xml version="1.0" encoding="UTF-8" ?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<env:Body>
<m:markupvalidationresponse env:encodingStyle="http://www.w3.org/2...
Hello.
I'm creating a Yahoo! Widget and have done this before without any problems (creating a widget).
I'm getting a xml document via a weblink and want to get all the nodes intro a tree. I'm doing this:
var request = new XMLHttpRequest();
request.open( "GET", url, false );
request.send();
if ( request.status == 200 )
...
It's so confusing. Could somebody please explain the difference?
...
To give some background to this problem first, I am rewriting some code that currently loops through some xml, doing an insert to a table at the end of each loop - replacing with a single sp that takes an xml parameter and does the insert in one go, 'shredding' the xml into a table.
The main shred has been done successfully,but curren...
I am performing a search in an XML file, using the following code:
$result = $xml->xpath("//StopPoint[contains(StopName, '$query')]");
Where $query is the search query, and StopName is the name of a bus stop. The problem is, it's case sensitive.
And not only that, I would also be able to search with non-english characters like ÆØÅæøå...
Can somebody explain me why is this not working?
I'm executing
XmlNode xmlNode = xmlDocument.SelectSingleNode("//(artist|author)");
and I get
System.Xml.XPath.XPathException: Expression must evaluate to a node-set.
but this works and does not raise the exception even when there are many artist nodes
XmlNode xmlNode = xmlDocument....
Hello,
I'd like to populate my DropDownList using a simple xml file:
<?xml version="1.0" encoding="utf-8" ?>
<Databases>
<Database>foo</Database>
<Database>bar</Database>
<Database>baz</Database>
</Databases>
My XPath is
/Databases/Database
My drop down list is rendered as:
<select name="databaseDropDownList" id="databaseD...
I'm using XPath 1.0 to process incoming web services messages. This can be quite hard to get right if schema data types are used, because XPath 1.0 does not recognize them (XPath 2.0 does, but there seems to be no full open source implementation. Not sure if Saxon-B does this).
E.g., the literals "true" and "false" in a xs:boolean repr...
XPath (v1) contains no way to encode expressions.
If you only have single OR double quotes then you can use expressions such as
//review[@name="Bob's Pizza"]
//review[@name='"Pizza" Pam']
But if you have BOTH e.g [Fred's "Fancy Pizza"] then you have to use something like this Escaping Strings in XPath (C++) to generate
//review[@n...
I've recently hit a wall with an issue with Java's native XML API (the W3C one) which at its core is that if I try to use a direct XPath expression in my document like, say, //body the XPath is evaluated as false (incorrect behaviour), however if I replace that with //*[1] it evaluates as true (desired behaviour).
I have checked numero...
Hello,
I have an array of objects that are IXpathNavigable. I want to access the array through an xsl extention object, so I should probably do that by using an XPathNodeIterator. But how do I properly create the NodeIterator so that it iterates over the array?
...
I use Nokogiri (Rubygem) css search to look for certain <div> inside my html. It looks like Nokogiri's css search doesn't like regex. I would like to switch to Nokogiri's xpath search as this seems to support regex in search strings.
How do I implement the (pseudo) css search mentioned below in an xpath search?
require 'rubygems'
requi...
I am using the following code to query some XML with XPath I get from a stream.
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
domFactory.setNamespaceAware(false);
DocumentBuilder builder = domFactory.newDocumentBuilder();
Document doc = builder.parse(inputStream);
inputStream.close();
XPathFactory factory = ...
I have a GWT application for which I'm trying to write some tests using Selenium.
I'm using XPath to identify the elements on the page for the tests. Using id won't work as the id values are auto-generated by GWT and can change. Things started going well when I realised I could find buttons by their labels as follows:
//button[.='OK'...
I'm trying to fill the variables parent_element_h1 and parent_element_h2. Can anyone help me use the Nokogiri Gem to get the information I need into those variables?
require 'rubygems'
require 'nokogiri'
value = Nokogiri::HTML.parse(<<-HTML_END)
"<html>
<body>
<p id='para-1'>A</p>
<div class='block' id='X1'>
...
I have some XML and an XPath query. I'm using Yahoo! widgets, so I'm using XPath 1.0.
Here's the gist of my XML...
<root>
<cat num="SOURCE">
<movie>
<swf>speak.swf</swf>
<width>250</width>
<height>150</height>
<colour>cccccc</colour>
</movie>
<movie>
...
While trying to parse html using Yahoo Query Language and xpath functionality provided by YQL, I ran into problems of not being able to extract “text()” or attribute values.
For e.g.
perma link
select * from html where url="http://stackoverflow.com"
and xpath='//div/h3/a'
gives a list of anchors as xml
<results>
<a class="qu...