xpath

Descendent-or-self in InfoPath

I want to use XPath code in an InfoPath form to sum the data in field12 when field11 is equal to IT. I tried using the following code, but it doesn't work. number(sum(/descendant-or-self::node()/my:group12[my:field11 = "IT;"]/my:field12)) I suspect this has to do with the multilayering of groups, as shown below. Does anyone know the c...

C# xml read/write/xpath without using XmlDocument

I am refactoring some code in an existing system. The goal is to remove all instances of the XmlDocument to reduce the memory footprint. However, we use XPath to manipulate the xml when certain rules apply. Is there a way to use XPath without using a class that loads the entire document into memory? We've replaced all other instances...

How to get only required xpath elements?

Hi Guys, I have an xml file that I want to store a node's rank attribute in a variable. I tried: echo $var = $xmlobj->xpath("//Listing[@rank]"); to no avail, it just prints ArrayArray. How can this be done? if($xmlobj = simplexml_load_string(file_get_contents($xml_feed))) { foreach($xmlobj as $listing) { ...

Xpath, retrieving node value

I get this return value from Sharepoint... which I have just included the first part of the xml snippet... <Result ID=\"1,New\" xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\"&gt; <ErrorCode>0x00000000</ErrorCode><ID /><z:row ows_ID=\"9\" It populates a XmlNode node object. How using xPath can I get the value of ows_id ? M...

Grabbing values from multiple xml rows in sql (ms server 2005)

Hi Guys, I will attempt to explain this situation as clearly as I can. I have this query below which tries to get a list of author_ids from an xml column in sql server 2005 associated with a book, but assigning the query to the @authorIds returns an error because it returns multiple rows, any ideas on how to run around this problem? Ma...

Need XPath to return the nodeset (grandparent[no uncles] + parent[no siblings] + self

Example of what I'm looking for. Here is the input: <AAA> <BBB id='1'> <CCC id='1'> <DDD id='1'/> <DDD id='2'/> </CCC> <CCC id='2'> <DDD id='3'/> <DDD id='4'/> </CCC> </BBB> <BBB id='2'> <CCC id='3'> <DDD id='5'/> <DDD id='6'/> </CCC> <CCC id='4'> ...

C# How to extract complete xml node set.

<?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book category="COOKING"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> <book category="CHILDREN"> <title lang="en">Harry Potter</title> <author>J K. Rowling</author> ...

put each text surrounded via html tag, into an array ?

using nokogiri, doc = Nokogiri::HTML(your_html) doc.xpath("//text()").to_s this does the job, however, it puts everything into one flat text. i need to take each text surrounded via html tags <b> text</b> <h1>text3</b> and put them into array. ["text", "text3"] what is the recommended action ? i thought of doing doc.xpath("*")....

How to make an xpath result into a string with PHP?

if($xmlobj = simplexml_load_string(file_get_contents($xml_feed))) { $result = $xmlobj->xpath("TrafficMeta"); } The above code returns the desired result and when viewed with print_r it shows this, which is what I want to get (sessionId): Array ( [0] => SimpleXMLElement Object ( [sessionId] => tbfm1t45xplzrongbtbdyfa5 ) ) How ca...

How determine the right xml to write out

<?xml version="1.0" encoding="UTF-8"?> <idmef:IDMEF-Message version="1.0" xmlns:idmef="http://iana.org/idmef"&gt; <idmef:Alert messageid="abc123456789"> <idmef:Analyzer analyzerid="bc-corr-01"> <idmef:Node category="dns"> <idmef:name>correlator01.example.com</idmef:name> </idmef:Node> </idmef:Analyzer> <id...

select parent node containing text inside children's node.

basically i want to select a node (div) in which it's children node's(h1,b,h3) contain specified text. <html> <div id="contents"> <p> <h1> Child text 1</h1> <b> Child text 2 </b> ... </p> <h3> Child text 3 </h3> </div> i am expecting, /html/div/ not /html/div/h1 i have this below, but unfortunately returns the children, instead of th...

How to select text before and after <br> in jQuery?

How can I select texts that are not surrounded by HTML tags, but simply preceding and following <br> tags ? I did it with xpath: .xpath('//br/following-sibling::text()|//br/preceding-sibling::text()') ...

XPath to find elements based on time values

I have the following XML, returned from a web service (5 extra points for guessing the movie): <ArrayOfSub xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/"&gt; <Sub> <SubId>862</SubId> <SubStreamId>1</SubStreamId> <SubTimeStart>00:01:04.4450000</...

HtmlAgilityPack example for changing links doesn't work. How do I accomplish this?

The example on codeplex is this : HtmlDocument doc = new HtmlDocument(); doc.Load("file.htm"); foreach(HtmlNode link in doc.DocumentElement.SelectNodes("//a[@href"]) { HtmlAttribute att = link["href"]; att.Value = FixLink(att); } doc.Save("file.htm"); The first issue is HtmlDocument.DocumentElement does not exist! What d...

Delphi/MSXML: XPath queries fail

I've loaded a XML document, and now I wish to run a XPath query to select a certain subset of the XML. The XML is <?xml version="1.0"?> <catalog xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'&gt; <book id="bk101"> <author>Gambardella, Matthew</author> <title>XML Developer's Guide</title> <genre>Computer</genr...

Hidden Features of Xpath+Xslt

What are the hidden features of XPath AND XSLT? ...

Using XPath to find the value of an attribute in a node based on another attribute in the same node?

I have an xml document that is constructed pretty poorly-- instead of child nodes, the items have multiple attributes. For Example: <makes> <option make="FORD" year_start="1950" year_end="2009" /> <option make="CHEVROLET" year_start="1965" year_end="2009" /> ... </makes> I'm trying to use XPath to select the value of the other attri...

expressing value of textbox in xpath ?

how can i express the value of a textbox in xpath ? the text that was just typed into the textbox. so if i type apple inside a textbox, i need to output the value of this in xpath. ...

what does this xpath expression mean ?

//input[@type="hidden" and @name="val" and position() = 1]/@value does this mean get the text typed inside the input box ? ...

how to make this javascript function output @value in the xpath ?

The code below, produces Xpath. However, it doesn't display @value attribute/property. It is not working very well. function getXPath(node, path, val) { path = path || []; if(node.parentNode) { path = getXPath(node.parentNode, path); } if(node.previousSibling) { var count = 1; var sibling = node.previousSibling do { if(siblin...