xpath

Select XML nodes as rows

I am selecting from a table that has an XML column using T-SQL. I would like to select a certain type of node and have a row created for each one. For instance, suppose I am selecting from a people table. This table has an XML column for addresses. The XML is formated similar to the following: <address> <street>Street 1</street> <c...

Using server-side XML Parser to generate HTML content.

Is it possible using a server side xml parser to have it create a html blob that it is then included in a existing html page? Thanks ...

XPath condition for printing xml block

Hi , I am uisng java api and using xpath to parse my xml. I have a xml likethis - <animals> <dog> <looks>dangerous </looks> <bites> hard </bites> <growls> yes </growls> </dog> <cat>nothing special</cat> </animals> I would like a xpath condition to print <dog> <looks>dangerous </looks> <bites> hard </bites>...

Equivalent of Firebug's "Copy Xpath" in Internet Explorer?

I have an internet-explorer only web application. I'm exploring what we can do to automate the testing. Selenium looks like a good tool, but to be able to activate links etc I need to tell selenium where they are. The application wasn't built with this kind of testing in mind, so there generally aren't id attributes on the key element...

Find position of a node using xpath

Anyone know how to get the position of a node using xpath? Say I have the following xml: <a> <b>zyx</b> <b>wvu</b> <b>tsr</b> <b>qpo</b> </a> I can use the following xpath query to select the third <b> node (<b>tsr</b>): a/b[.='tsr'] Which is all well and good but I want to return the ordinal position of that node,...

XPath in C# code behind of WPF

You can use XPath if you're binding the XML document in the XAML, but what if you're loading the XML document dynamically in the code behind? Is there any XPath methods available in the C# code behind? (using .NET 3.5 SP1) ...

XPath query with PHP

Here's the XML code i'm working with: <inventory> <drink> <lemonade supplier="mother" id="1"> <price>$2.50</price> <amount>20</amount> </lemonade> <lemonade supplier="mike" id="4"> <price>$3.00</price> ...

XPath search with ElementTree

New to xml. Looking for XPath to search a xml file with python ElementTree format <root> <child>One</child> <child>Two</child> <child>Three</child> </root> to do search for child with "Two" and return true/false if it was started off like from elementtree import ElementTree root = ElementTree.parse(open(PathFile)).getroot() how ...

Baffled by an XPath issue on IE

David Flanagan's excellent book on JavaScript has an example that shows how to perform XPath queries in IE. On page 518 of fifth edition, you can see the following code snippet taken from example 21-10: // In IE, the context must be an Element not a document, // so if the context is a document, use the documentElement instead if (contex...

Get the names of attributes from an element in a SQL XML column

For this xml (in a SQL 2005 XML column): <doc> <a>1</a> <b ba="1" bb="2" bc="3" /> <c bd="3"/> <doc> I'd like to be able to retrieve the names of the attributes (ba, bb, bc, bd) rather than the values inside SQL Server 2005. Well, XPath certainly allows this with name() but SQL doesn't support that. This is my chief complaint wi...

Parsing an NSXMLElement in Cocoa

Hey all, I'm trying to use XPath to parse an XML document. One of my NSXMLElement's looks like the following, hypothetically speaking: <foo bar="yummy"> I'm trying to get the value for the attribute bar, however any interpretation of code I use, gives me back bar="woo", which means I need to do further string processing in order to o...

how to disable dtd at runtime in java's xpath ?

I got dtd in file and I cant remove it. When i try to parse it in Java I get "Caused by: java.net.SocketException: Network is unreachable: connect", because its remote dtd. can I disable somehow dtd checking? ...

not strict xpath for java

do you know any not strict xpath for java? (I want it to not check dtd and schema) and it would be cool if it dont care about correct xml. ...

Using XPATH to search text containing  

I use XPather Browser to check my XPATH expressions on an HTML page. My end goal is to use these expressions in Selenium for the testing of my user interfaces. I got an HTML file with a content similar to this: <tr> <td>abc</td> <td>&nbsp;</td> </tr> I want to select a node with a text containing the string "&nbsp;". With a no...

Using XPath: find last text node of each paragraph under the root node.

I want to trim trailing whitespace at the end of all XHTML paragraphs. I am using Ruby with the REXML library. Say I have the following in a valid XHTML file: <p>hello <span>world</span> a </p> <p>Hi there </p> <p>The End </p> I want to end up with this: <p>hello <span>world</span> a</p> <p>Hi there</p> <p>The End</p> So I w...

Implementing GetByClassName for a .Net XmlDocument.

I am using an XmlDocument to parse and manipulate an XHTML string, converting some nodes to non-HTML nodes. What is the best way to get a list of all nodes with a given class name? Can it be done with XPath? ...

Reading the value of an input using XPath, then using in Greasemonkey

Hi - I'm using this XPath to get the value of a field: //input[@type="hidden"][@name="val"]/@value I get several results, but I only want the first. Using //input[@type="hidden"][@name="val"]/@value[1] Doesn't work. Once I have this, how do I pick up the value in Greasemonkey? I am trying things like: alert("val "+val.snapshotItem...

How can I do string operations in XSLT?

I have the following code block in my xslt; <xsl:when test="StatusData/Status/Temperature > 27"> <td bgcolor="#ffaaaa"> <xsl:value-of select="StatusData/Status/Temperature" /> </td> </xsl:when> But as you might guess when the value is 34,5 instead of 34.5 it is recognis...

XPATH or XSL to match two node-sets using custom comparison

EDIT: I also have access to ESXLT functions. I have two node sets of string tokens. One set contains values like these: /Geography/North America/California/San Francisco /Geography/Asia/Japan/Tokyo/Shinjuku The other set contains values like these: /Geography/North America/ /Geography/Asia/Japan/ My goal is to find a "match" betwe...

Importing which library?

Hi all, recently I downloaded this open source project and I am trying to compile it. However, one of the line is giving me an error. "import com.sun.org.apache.xpath.internal.functions.WrongNumberArgsException;" Seems that i am missing a library.... is there a way to know WHICH library do I need? I tried searching on google for com...