xpath

Can't get this XPath to work...

Hi all, I have some XML: <metadata> <dataIdInfo> <idCitation> <resRefDate> <refDate>1996</refDate> <refDateTyp> <DateTypCd value="007" /> </refDateTyp> </resRefDate> <resRefDate> <refDate>1998</refDate> <refDateTypCd> <DateTypCd value="003" /> <...

vb.net - Getting the Xpath of XSD schema elements

Can the Xpath of XSD schema text() elements be retrieved in vb.net? For example, how can you get this Xpath from the following schema; parent/child/grandchild <?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSche...

PHP Xpath help.

Hi, Can anyone point me to a good tutorial on xpath or give me a quick lesson here? Also if xpath is for querying xml, what would I need to use to modify the xml? I guess it would need to be something that works hand in hand with xpath? Cheers, Franky ...

XSL Test Question, what is this testing?

I have this line: <xsl:when test="document('foo.xml')/field_config/field_rename/field[@old_name = $name]/@new_name"> foo.xml: <field_config> <field_rename> <field old_name="Modified" new_name="modification"/> <field old_name="Created" new_name="creation"/> </field_rename> </field_config> In general, what is this testing? ...

NSXMLDocument, nodesForXPath with namespaces

I want to get a set of elements from a xml-file, but as soon the the elements involve namespaces, it fails. This is a fragment of the xml file: <gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" creator="Groundspeak Pocket Query" xsi:schemaLocation="ht...

jquery xpath selection not working ?

I need a way to select elements via xpath (NOT CSSpath or any other method, must strictly be xpath) $(document).find("/html[1]/body[1]/div[4]/div[2]/div[1]/h1[1]/a[1]").css("background-color", "yellow") This doesn't seem to work. ...

Removing node using xquery

Hi, I am trying to remove a child node from a parent node using xquery. Say, I have an entry shown below in my xml: <entry> <id>36</id> <title>Engineering Village Author Tool</title> <updated>2009-09-30T12:55:42Z</updated> <libx:libapp> <libx:entry xmlns:libx="http://libx.org/xml/libx2" src...

Grabbing links using xpath in php

i am trying to grab links from the Google search page. i am using the be below xpath to //div[@id='ires']/ol[@id='rso']/li/h3/a/@href grab the links. xPather evaluates it and gives the result. But when i use it with my php it doesn't show any result. Can someone please tell me what I am doing wrong? There is nothing wrong with the cU...

XPath to get the element with the highest ID

XML Source: <documents> <document> <id>3</id> </document> <document> <id>7</id> </document> <document> <id>1</id> </document> </documents> I need the document-element with the highest value in its id-element (so <document><id>7</id></document> in the example). I can't change the C# code,...

Problem running xpath query with namespaces

Hi, I'm trying to use an xpath expression to select a node-set in an xml document with different namespaces defined. The xml looks something like this: <?POSTEN SND="SE00317644000" REC="5566420989" MSGTYPE="EPIX"?> <ns:Msg xmlns:ns="http://www.noventus.se/epix1/genericheader.xsd"&gt; <GenericHeader> <SubsysId>1</SubsysId> <S...

xpath query to parse html tags

I need to parse the following sample html using xpath query.. <td id="msgcontents"> <div class="user-data">Just seeing if I can post a link... please ignore post <a href="http://finance.yahoo.com"&gt;http://finance.yahoo.com&lt;/a&gt; </div> </td> <td id="msgcontents"> <div class="user-data">some text2... <a href="http://abc.com...

PHP Getting parent's ID => child's value as array from XML

I have an XML file structured like this <serieslist> <series sid="123"> <title type="main">Series 123 Main Title</title> <title type="official">Series 123 Official Title</title> <title type="short">S 123</title> </series> <series sid="456"> <title type="main">Series 456 Main Title</title> ...

help to understand XPath

I have such xpath expression : link[@rel='alternate' and @type='text/html' or not(@rel)]/@href | link/text() ? Acctually I don't understand the symbol | ...

Trying to Filter XML using XPath

I'm trying to filter an XML file using XPath. The XPath that I'm using is definitely filtering to the data that I want, but I'm just not sure how to filter the file overall. Here's the sample XML file: <fields> <field name='F'> <field name='0'><value>F.0 stuff</value></field> <field name='1'><value>F.1 stuff</val...

Using xpath with HTML or XML fragment in Nokogiri

I am new to Nokogiri and xpath and I am trying to access all comments in a HTML or XML fragment. The xpath ".//comment()" and "//comment()" works when I am not using the fragment function, but it does not find anything with a fragment. With a tag instead of a comment, it works with the first xpath. By trial and error, I realized that in...

Extracting value of default attribute in XSLT

I have a very specific problem where I want to be able to extract the default attribute value of an element as illustrated in the example below. Every item in the input XML contains multiple child name elements, one to represent the primary name, which is the default attribute value (type='main') and another secondary name (type='short'...

List all Persistence Units in persistence.xml

Hi all, I am trying to use XPath to get a list of all the persistence units in persistence.xml and am having trouble. The one that I thought would work was: //persistence/persistence-unit * The latter gives me the persistence child which is at least something, I can then manually iterate through, but that defeats the purpose of XPa...

What is exact xpath for the first childnodes of a node?

I have a XML code like this: <?xml version="1.0" encoding="utf-8" ?> <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Grid> <Label/> <Label/> <Label/> </Grid> </Window> In code, this is represented...

use xpath select certain nodename

I followed the tut in w3school http://www.w3schools.com/xpath/xpath_syntax.asp it says: nodename Selects all child nodes of the named node bookstore Selects all the child nodes of the bookstore element and here's my code bookstore.xml: <?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book> <title lang="eng">Ha...

LibXML doesn't find any nodes for my xpath expression

Hello! I'm using xpath and LibXML in an iPhone app to find some nodes in an xml document. I'm a noob in xpath so probably i am doing something wrong. Here is the xml: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs...