xpath

What is wrong with this xsd?

The following XSD should validate that the favorite_fruit element's name attribute should only contain names of fruit in the fruits element. Here is the XSD: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; <xsd:complexType name="Fruit"> <xsd:attribute name="name" type="xsd:string"/> </xsd:complexType> <xsd:comp...

is it possible to fix the problem in HtmlAgilityPack when there is a not closed html tag?

well i have the following problem. the html i have is malformed and i have problems with selecting nodes using html agility pack when this is the case. the code is below: string strHtml = @" <html> <div> <p><strong>Elem_A</strong>String_A1_2 String_A1_2</p> <p><strong>Elem_B</strong>String_B1_2 String_B1_2</p> </div> <div>...

another question about getting entries from StackOverflow atom feed

I feel like an idiot for asking this question again, as I know it's been asked several times. I cannot for the life of me get this code working even with the answers that have already been provided, so I'm hoping that by offering my current code, someone can help me determine where I'm going wrong: Dim RSSReader As New Xml....

Performing a "Group By" query in XPath XSL

Hi, Given the following XML: <results name="queryResults"> <int name="intfield1:[* TO 10]">11</int> <int name="intfield2:[10 TO 20]">9</int> <int name="intfield1:[10 TO 20]">12</int> </results> I would like to produce this XML: <results> <field name="numberfield1"> <value name="[* TO 10]">11</value> <val...

Why doesn't DOMXPath work?

I've been trying to write a PHP script to parse an XML document using DOMXPath; however it seems I'm missing something because none of my XPath queries are returning anything. So I've tried to water down my script to try and parse a very rudimentary XML document, and that's not working either. I've based this script off of this XPath exa...

JavaScript: document.evaluate() problem

I am trying to get all objects but it doesn't work. var tmp = document.evaluate("//tr", document, null, XPathResult.ANY_TYPE, null); tmp.iterateNext returns me null; ...

Xpath builder in Python

I'm building relatively complicated xpath expressions in Python, in order to pass them to selenium. However, its pretty easy to make a mistake, so I'm looking for a library that allows me to build the expressions without messing about with strings. For example, instead of writing locator='//ul[@class="comment-contents"][contains(., "Wes...

Is there a compressed representation of Xpath?

I am working on a project which requires working with XPath (on HTML). The (multiple) XPath is transferred to client-side inside JavaScript. Since XPath strings are long, I was wondering if there is a shorter representation which is equivalent to XPath? Perhaps one which works sort of like huffman encoding but specific to XPath. ...

Can I use xpath 2.0 with firefox and selenium?

I saw other questions referring to xpath 2.0, which apparently simplifies string expressions. I'm using Firefox 3.5.5 and selenium 1.0.1. How can I check if my versions of Firefox and Selenium support it? Does Selenium defer to Firefox's built-in Xpath implementation? In that case, if I start using another (perhaps older) browser with ...

Dynamically updating RDF File

Is it possible to update an rdf file dynamically from user generated input through a webform? The exact scenario would beskos concept definitions being created and updated through user input to html forms. I was considering xpath but is there a better / generally accepted / best practice way of doing this kind of thing? ...

XPath and Hpricot -- works on some machines, not others?

The following hpricot code successfully extracts the STPeriods in the XML on two of my machines (Vista and an Ubuntu server) but fails on another Ubuntu laptop. All machines have Hpricot v0.82 Any ideas? Totally stumped. Hpricot code: (doc/"WeatherFeed/Location/WxShortTerm/STPeriod").each do |ham_forecast| XML file <?xml version=...

getting only subsequent siblings of same type using xpath and simplexml

I need to parse a html definition list like the following: <dl> <dt>stuff</dt> <dd>junk</dd> <dd>things</dd> <dd>whatnot</dd> <dt>colors</dt> <dd>red</dd> <dd>green</dd> <dd>blue</dd> </dl> So that I can end up with an associative array like this: [definition list] => [stuff...

DotNetNuke + XPath = Custom navigation menu

I'm developing a skin for DotNetNuke 5 using the DNN Done Right menu component which uses an custom XSL-T to convert the XML sitemap into an HTML navigation. Using XSL-T is a life saver in comparison to the other ways of building a navigation menu. However I've run into problems doing something a little more complex, as I'm a newcomer t...

jmeter how to process an xml using Xpath in beanshell

These are troubles i have faced when using JMeter Xpath extractor. I have an xml which contains an attribute with the CDATA value which is a valid xml too. My scope is to parse the CDATA xml within one iteration. I found out that i won't be able to parse the CDATA held in primary xml using the same JMeter XPath extractor. So i have decid...

Is there a python hamcrest matcher library for performing XML document matching?

I'm interested in both xpath matching and full document comparisons: assert_that(mydoc, hasTextAtXPath('/foo/bar', 'text')) assert_that(mydoc, matchesStructurally('<some_xml/>')) Does any matcher library exist for this? If not, what is the best place to start with for this type of comparison, so that I can write one of my own? ...

How sort xml by distinct data using classic asp?

hi this is my xml <XMLResponse> <Product> <Items> <ID>AA</ID> </Items> <Items> <ID>BB</ID> </Items> <Items> <ID>CC</ID> </Items> <Items> <ID>AA</ID> </Items> <Items> <ID>AA</ID> </Items> <Items> <ID>BB</ID> </Items> </Product> </XMLResponse> this is the code i using in my classic asp <% Response.ContentType = "text/plain; charset=UT...

calling namespace-uri in C#, namespace-uri has an invalid token.

Hi, I am executing the following. Given an XDocument doc; doc.XPathEvaluate("//namespace-uri()"); I get the error '//namespace-uri()' has an invalid token. It seems to work in a node test, for example "//*[namespace-uri()='xyz']". The function should work though, XMLSPY is happy with the above version, and I believe it uses the same...

.net 2.0 c# retrieving a value from xml

I realize this is a repost but I needed to as I can't use LINQ, ( requested in my previous post). I need to read the woeid from the XML doc below. I need to read and store the data into a string variable so I can query the yahoo weather service. XML returned by query: <query yahoo:count="1" yahoo:created="2009-12-22T08:30:31...

Xsl how to get next block of text using .NET xslt

I have a document which when simplified looks like this: <?xml version="1.0"?> <document> <br/> <div class="Heading">Introduction</div> <div class="Text">Sed quis malesuada ligula. Aliquam eu felis nulla, ac tempus purus.</div> <br/> <div class="Heading">Background</div> <div class="Text">Curabitur adipiscing tor...

XPath. Select nodes based on an other, related node

Hi All, I have an xml that contains two groups of related values: <Rows> <!-- first group --> <Row> <Sequence>100</Sequence> <Value>+</Value> </Row> <Row> <Sequence>105</Sequence> <Value>+</Value> </Row> <Row> <Sequence>110</Sequence> <Value>-</Value> </Ro...