xpath

problem using select : "//somenode"

Hey everyone im trying to use <xsl:for-each select="//node1"> in my xsl the problem is that it gets all the nodes name node1 together and not passing them one by one (as for each should be) just for you to know im using // pattern becuase my xml changes and i do need to find inside some node the node1 hope you can help... ...

Best interface for reading XML in PHP?

SimpleXML seems ok, but one thing that's annoying is whenever assigning/storing a value you have to typecast it - this really is a tad annoying. DOM is ok but I really like the flexibility of XPath, sometimes DOM can be a tad too much writing-wise. I really like the selector implementation in jQuery, and the flexibility. I came across ...

Build XML using XPATH - C#

Hi Guys, I saw this post does anyone knows about some C# framework doing similar like dom4j do? I need to build up XMLs using XPATHs. Cheers, DD ...

XPath | path expression .Net

<?xml version="1.0" encoding="UTF-8"?> <Country> <States> <County> <popularity>39</popularity> <name>Orange</name> <id>13811</id> <url>http://www.url.gov&lt;/url&gt; <overview>Orange County Overview</overview> <Cities> <City name="City #1" size="big" population="33333"/> <City nam...

XPath query for empty namespace xmlns=""

What XPath do I use to query the info node in the xml below? I've tried different expressions in XMLSpy but nothing works. <root xmlns="tempuri.org" xmlns:p="http://nonamespace.org/std/Name/2006-10-18/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; <item xmlns=""> <info>blah blah</info> <date>2009-07-27 00:00:00</date> </...

XSLT - boolean true if attribute value character length greater than 10

I attempted this to count the total characters of my title attribute value, but it didn't seem to evaluate as I intended it to: <xsl:if test="count(@title)>10"> <xsl:attribute name="class">double-line</xsl:attribute> </xsl:if> I also tried to append /text() to @title. It looks like I'm still off. Any suggestions? ...

C# and XPath - how to query

Hi folks, I have an XML-File, which has the following structure: <mediawiki ...> <siteinfo>...</siteinfo> <page> <title>The Title</title> <id>42</id> ... </page> ... more page items ... </mediawiki> I red a bit about XPath-Query and wrote the following code: _xmlArticlesDocument = new XmlDocument(); _xmlArticlesD...

XPath Search troubles.

I can't seem to grab this specific node. <w:body> <w:p wsp:rsidR="00D12EE7" wsp:rsidRDefault="00F86B09"> <w:fldSimple w:instr=" MERGEFIELD GAS_REAFCity "> <w:r> <w:rPr> <w:noProof/> </w:rPr> <w:t>«GAS_REAFCity»</w:t> </w:r> </w:fldSimple> </w:p> </w:bod...

XPath: How to select elements based on their value?

I am new to using XPath and this may be a basic question. Kindly bear with me and help me in resolving the issue. I have an XML file like this: <RootNode> <FirstChild> <Element attribute1="abc" attribute2="xyz">Data</Element> <FirstChild> </RootNode> I can validate the presence of an <Element> tag with: //Element[@attribute1=...

VBScript, MSXML and Namespaces

Given the following XML: <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; <soap:Body> <GetMsisdnResponse xmlns="http://my.domain.com/"&gt; <GetMsisdnResult> <RedirectUrl>ht...

Java and xpath - xHtml parsing problem

I'm trying to parse a well formed xhtml document. I'm having problems during the nodes iteration. My xHtml has a structure like <?xml version="1.0" encoding="UTF-8"?> <html> <head>...</head> <body> ... <form> ... <div class="AB"> (1 or 2 times) ... <div class="CD"> ... <tab...

select node ranges using XPath

We are using XPath in a Java app and I was wondering: How do I select a set of nodes where the "terminating point" is a node not belonging to the same kind as it's siblings. For example, I want to get two sets of <a> tags of size 3 and 2 from the example below: <sample> <a /> <a /> <a /> <terminating /> <a /> <a /> ...

Checking node contents against a given set of values

Given an XML document such as this: <root> <foo> <bar>a</bar> <bar>b</bar> <bar>c</bar> </foo> ... </root> How can I retrieve all foo-nodes that have bar-subnodes with certain values? So for instance, if I need all foo-elements that have bar-subelements with values a and c, I am currently using thi...

xpaths not working in java

Hi. I am trying to access a url, get the html from it and use xpaths to get certain values from it. I am getting the html just fine and Jtidy seems to be cleaning it appropriately. However, when I try to get the desired values using xpaths, I get an empty NodeList back. I know my xpath expression is correct; I have tested it in other way...

Working with the SQL Server XML data type

I've got a table which has a XML field. The typical XML it contains is; <things> <Fruit> <imageId>39</imageId> <title>Apple</title> </Fruit> <Fruit> <imageId>55</imageId> <title>Pear</title> </Fruit> <Fruit> <imageId>76</imageId> <title>Grape</title> </Fruit> </things> In my table i've got around 50...

xslt test to see if a node is one of the first X children of its parent

I am editing an XSLT template and my skills are a little rusty. I would like to write a condition to see if the current node is in the first three child nodes of its parent. <parent> <child> <child> <child> <child> </parent> So the first three child elements above would return true, but the fourth would return false, to complicat...

XSLT/XPath : No upper-case function in MSXML 4.0 ?

I try to use upper-case() in an XPATH, my parser is MSXML 4.0, and I get : upper-case is not a valid XSLT or XPath function. Is it really not implemented ? ...

Selenium.IsElementPresent using a Select Option's text (C#)

I'm using Selenium in C# with Selenium RC to do some automated interaction testing but have come across a stumbling block. Given this HTML: <select id="my-select-list"> <option value="1">First option</option> <option value="2">Second option</option> <option value="3">Third option</option> <option value="4">Fourth option...

is it possible to specify a OR in a Xpath in a XSD?

I want to be able to guarantee uniqueness for two types of elements : MainQuestion and AlternateQuestion. In the select query for my xsd:key, can I specify something that would do "//MainQuestion or //AlternateQuestion"? Someone told me that something like this existed, but it seems that XSD only supports a subset of the XPath syntax......

Store a group of nodes as a variable in XSLT?

So here is my current code: <xsl:variable name="address"> <xsl:value-of select="concat(/node1/node2/address.node/street, /node1/node2/address.node/city, /node1/node2/address.node/zip)" /> </xsl:variable> Now, I'm trying to shorten this down to: <xsl:variable name="addressNode"> <xsl:value-of select="/node1/node2/address.node"...