xpath

Trying to use RemoveChild() on XmlNodeList messes up my XmlNode collection

Hi there, I'm trying to remove a specific node from a XmlNodeList named listaWidths. This specific list has 5 items before I use RemoveChild(). But, after the RemoveChild() statement, the list stays only with 1 item. XmlNodeList listaWidths = xmlDoc.SelectNodes("/MsBuild:Report/MsBuild:Body/MsBuild:ReportItems/MsBuild:Tablix/MsBuild:Ta...

Grandchildren of an element (XPath)

I'm searching for a XPath expresssion, which gives me all grandchildren of an element. Is this correct: child/child/* ? ...

validating whether a element exists and has some specific value in xsl

how to check the tag exists and the value is 'On' do something in xsl please correct me., <xsl:if test="$status and $status='On'"> //do something </xsl:if> can we skip checking whether the tag exists and direclty check for the value. <xsl:if test="$status='On'"> //do something </xsl:if> is it a correct practice., ...

xpath 2.0 query - how to test if the current element is the first element with this name in a xml document

I have the following xsl template: <xsl:template match="para"> <fo:block xsl:use-attribute-sets="paragraph.para"> <!-- if first para in document --> <!--<xsl:if test="//para[1] intersect .">--> <xsl:if test="//para[1] intersect ."> <xsl:attribute name="space-after">10pt</xsl:attribute> ...

help with selecting nodes with xpath

my xml structure looks like this: <entity id="1000070"> <name>apple</name> <type>category</type> <entities> <entity id="7002870"> <name>mac</name> <type>category</type> <entities> <entity id="7002907"> <name>leopard</name> <ty...

Xpath Injection detection tool

I am working on XPath Injection attack, so looking forward to build a tool to detect XPath Injection in a website. Is web crawling and scanning used for this? What can be the logic to detect it? Are there any open source tools to detect it, so that i can develop it in Java by looking at logic used in that code. ...

Short hand for number of tags having lengthier [and almost same] Xpath

For example : this is an xslt <xsl:template match="/root/sub-root/parent/child/grand_child/dummy1/dummy2/dummy3/dummy4/node_1 |/root/sub-root/parent/child/grand_child/dummy1/dummy2/dummy3/dummy4/node_2 |/root/sub-root/parent/child/grand_child/dummy1/dummy2/dummy3/dummy4/node_3 . . |/root/sub-root/parent/child/grand_child/dummy1/dummy2...

XPath to find element based on another XPath element

Hi, I have an Java AST and I try to find a variable inside it via XPath. Lets say the variable is called 'foobar' I could use //VariableDeclarator/VariableDeclaratorId[@Image='foobar'] but what if I dont know the text 'foobar', but want to read it from another element //VariableDeclarator/VariableDeclaratorId[@Image=//Synchroni...

XPath find element based on ancestor element

Hi, again I have Java AST which is created from public class Test { String o = new String("hh"); public void wrong1() { synchronized(o) { // huhu } } } I try to create a XPath query which finds the synchronized block in which the defined String variable o is used. As the definition is above it...

Using XSLT, how do I separate nodes based on their value?

I have a pretty flat XML structure that I need to reorder into categorised sections and, for the life of me, I can't figure out how to do it in XSLT (not that I'm by any means an expert.) Basically, the original XML looks kinda like: <things> <thing> <value>one</value> <type>a</type> </thing> <thing> <value>two</value...

What do "+", "@" and "*" mean in an XPath query?

On the iReport documentation I found these XPath queries: /addressbook/category@name /addressbook/category/person@id /addressbook/category/person+LASTNAME /addressbook/category/person+FIRSTNAME /addressbook/category/person+hobbies*hobby My questions: Is category@name the same as category/@name? What's the meaning of person+LASTNAME?...

XML: Check if anything exists between two nodes

Hi there, I need to find out if anything exists between two nodes. My XML looks like this: <event value1="1" value2="2" value3="3" info="some info here"> Line 1.<lb/> Line 2.<lb/><lb/> Line 3.<lb/> Line 4.<lb/> </event> My goal is to convert the <lb/> nodes to <br/> HTML tags using XSLT. There ...

remember the highlighted text in html page(add annotation to html page)

Hi, I have an HTML file, i am opening it with webkit,i want to develop an app, such that after opening it, i should be able to select some text and make it highlighted(say by pressing some button 'highlight text' ). And it should remember the highlighted text so that when i open it next time it should highlight the same text automatical...

XPath select an attribute based on value

Using VB.Net, I have an XmlNode object, xNode. I need to select an attribute of this node if it has a particular value. e.g. xNode.SelectSingleNode(".[@attr1='1']") I would expect this statement to return the attribute "attr1", only if it has a value of "1". However, I get an error - Expression must evaluate to a node-set. When I tr...

How do I use XPath with a default namespace with no prefix?

What is the XPath (in C# API to XDocument.XPathSelectElements(xpath, nsman) if it matters) to query all MyNodes from this document? <?xml version="1.0" encoding="utf-8"?> <configuration> <MyNode xmlns="lcmp" attr="true"> <subnode /> </MyNode> </configuration> I tried /configuration/MyNode which is wrong because it ignores the...

XML parsing problem

I'm having this strange XML parsing problem. I have this XML string I'm trying to parse <?xml version="1.0"?> <response status="success"> <lot>32342</lot> </response> I'm using XPath with Java in order to do this. I'm using the Xpath expression "/response/@status" to find the text "success". However whenever I evaluate this expressi...

Matching first set of elements with xpath...

I have an xml document that looks like this. <foo> <bar type="artist"/> Bob Marley </bar> <bar type="artist"/> Peter Tosh </bar> <bar type="artist"/> Marlon Wayans </bar> </foo> <foo> <bar type="artist"/> Bob Marley </bar> <bar type="artist"/> Peter Tosh </bar> <bar type="artist"/> Marlon Wayans </bar> </foo> <fo...

xpath/xslt to determine index of context node relative to all nodes of same name?

Given the schema below - with a "query" node as the context, is it possible with xpath/xslt to determine the index of that "query" node relative to all "query" nodes in the document (not position() relative to its immediate siblings). TIA, Geoff <section> <name>About</name> <link>about</link> <questions> <questio...

Navigation and WebBrowser control

Hi, Can i use XPAth expressions to navigate through DOM elements in WebBrowser control? May be attaching javascript code and use document.evaluate function is right way? Can another activeX browser component(firefox,webkit.net) help me to solve my task? ...

How to use javascript-xpath

I am using Selenium RC with IE 6 and XPath locators are terribly slow. So I am trying to see if javascript-xpath actually speeds up things. But could not find enough/clear documentation on how to use native x- path libraries. I am doing the following: protected void startSelenium (String testServer, String appName, String testInBrowse...