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...
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...
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)
{
...
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/\">
<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...
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...
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'>
...
<?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>
...
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("*")....
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...
<?xml version="1.0" encoding="UTF-8"?>
<idmef:IDMEF-Message version="1.0" xmlns:idmef="http://iana.org/idmef">
<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...
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 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()')
...
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/">
<Sub>
<SubId>862</SubId>
<SubStreamId>1</SubStreamId>
<SubTimeStart>00:01:04.4450000</...
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...
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'>
<book id="bk101">
<author>Gambardella, Matthew</author>
<title>XML Developer's Guide</title>
<genre>Computer</genr...
What are the hidden features of XPath AND XSLT?
...
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...
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.
...
//input[@type="hidden" and @name="val" and position() = 1]/@value
does this mean get the text typed inside the input box ?
...
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...