i Am new to selenium webdriver and I want to automate a webpage related to my project. I am currently working on login page, however I facing problem with the login button which I am confused which locator to use. The login button is below: a href="javascript:LoginSubmit('Log In')"> img border="0" src="/opensso/login_images/button_enter.gif" alt="enter / entrez" Can you guys please help me out how to use the above with xPath or anything related to JavaScript? Sorry if I am missing anything, as I am very new to this.

Member Avatar
+0 forum 0

I have an xml structure : <Pages> <!--This is the root node--> <Home> <url>...</url> <menu> <item>Help</item> <item>About</item> <item>Contact</item> </menu> </Home> <Help> <url>...</url> <menu> <!--i need to select this if its parent(Help) is listed in Home/menu/item above--> <item>Business Help</item> <item>Web Help</item> <item>Tour Help</item> </menu> </Help> <About> <url>...</url> <menu> <!--And Or select this if its parent(About) is listed in Home/menu/item above--> <item>About us</item> <item>About our food</item> </menu> </About> <Contact> <url>...</url> <menu> <!--And Or select this if its listed in Home/menu/item above--> ... and so on... ... </menu> </Contact> </Pages> i issued an xpath expression to fetch all menu node in the document, …

Member Avatar
+0 forum 0

Hi there ! I have xml and xsl files i need to convert them to xslfo files . I need this to convert to pdf files. Thanks.

Member Avatar
Member Avatar
+0 forum 2

Hi What would be a good recommendation for a practical resources on using xml, xpath and xquery? By practical I mean. Accessing values, storing files, creating set queries on xml to create a feed to push data to other applications (eg ipython, rstudio, the Web) maintaining data integrity, and transformng data types. Note I have completed the [W3c tutorials](http://www.w3schools.com/xml/). Thank you for taking time to help me. Sayth

Member Avatar
Member Avatar
+0 forum 1

I have an xml structure : <Articles> <Article ID="111"> <author>Peter Paul</author> <pubDate>01/01/2015</pubDate> <Translations> <lang1>English</lang1> <lang2>French</lang2> <lang3>Arab</lang3> <lang3>Chinese</lang3> </Translations> </Article> <Article ID="222"> <author>Monkey Rice</author> <pubDate>01/01/2016</pubDate> <Translations> <lang1>English</lang1> </Translations> </Article> <Article ID="333"> <author>John Silas</author> <pubDate>01/01/2017</pubDate> <Translations> <lang1>English</lang1> <lang2>French</lang2> <lang3>Arab</lang3> <lang3>Chinese</lang3> </Translations> </Article> </Articles> i created a method AddRecordByInfoMatch() that attempts to add new node to any <Article> of a given ID anywhere as long as a match exists: function AddRecordByInfoMatch($ParentID, $Info_1, $Info_2, $Info_3, array $Record){ $xml = new SimpleXMLElement(blabla.xml); $result = $xml->xpath("//*[@ID='$ParentID']"); //get the article ID if(!empty($result)){ foreach($result[0] as $key => $value){ $noofChild = count($value); //three info match may lakely be within …

Member Avatar
+0 forum 0

Is it possible to count the instances of a for-each boolean statement. for example, say you have patients in a hospital and certain criteria must be met to discharge them. 100(%0) health would equal a discharge, pseudo code would read something like this: totalHealth - HighTemperature + medication * recoveryPeriod could you then have a choose statement to count the number of patients discharged or still in hospital? eg <xsl:choose> <xsl:when test="(totalHealth - HighTemperature + medication * recoveryPeriod) &gt; = 90"> Discharged Patients - <xsl:value-of select="count(true)"/> </xsl:when> <xsl:otherwise> Current Patients - <xsl:value-of select="count(false)"/> </xsl:otherwise> <xsl:choose> I know this code is …

Member Avatar
Member Avatar
+0 forum 9

I can't figure out two expressions in xpath. Can someone help ? Here they are substring-after(substring-before(//ul[@id='biblio']/li[3], ']', '[')) //h2[normalize-space(string())='name']/preceding::h1[1]

Member Avatar
Member Avatar
+0 forum 1

<?php $variable=$_POST['module']; $xmldoc = new DOMDocument(); $xmldoc->load('info.xml'); $xpathvar = new Domxpath($xmldoc); $queryResult = $xpathvar->query("testcase[substring-after( substring-after(script, '/'), '/' ) = '$variable' or substring-before( substring-after( substring-after(script, '/'), '/' ), '/' ) = '$variable']"); foreach($queryResult as $var) { echo $var->textContent; echo "\n"; } ?> I have written this code to fetch those content of xml file where my given condition is satisifed. Current my output is like - DebugLogging_F_05._IPv4_RIP 970249 WIRED scripts/testSuite/hostAgentFeatures/debugLogging/debugLoggingFeatureTesting/Ipv4Rip.tcl This test case verifies that the Debug RIP messages are present in debug log. TCL STC OK 46371 NULL ALL BASELINE RIP ROUTING target:system:family:2510-24,target:system:family:2510-48,target:system:family:2510G,target:system:family:2610,target:system:family:2615,target:system:family:2620,target:system:family:2626,target:system:family:2650,target:system:family:2810,target:system:family:2824,target:system:family:2848,target:system:family:2900,target:system:family:2910,target:system:family:2915,target:system:family:2920,target:system:family:3500,target:system:family:3500jr,target:system:family:3500strk,target:system:family:3800,target:system:family:3800FIPS,target:system:family:4100,target:system:family:4200,target:system:family:5300,target:system:family:5400,target:system:family:5400FIPS,target:system:family:5400R,target:system:family:5400RFIPS,target:system:family:6100,target:system:family:6600,target:system:family:8200,target:system:family:8200FIPS,target:system:family:stack-AR,target:system:family:stack-TA DebugLogging_F_06._IPv4_FIB 987839 WIRED scripts/testSuite/hostAgentFeatures/debugLogging/debugLoggingFeatureTesting/DebugLoggingIPv4FIB.tcl The purpose of …

Member Avatar
Member Avatar
+0 forum 1

I have two similar nodes in an XML file. When using a CONTAINS query via XPATH, the XPATH query returns two sets of data. I would like it to only return the exact match. Any idea if this is possible? Here is my code: $uc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $lc = "abcdefghijklmnopqrstuvwxyz" ; $lats = $users->xpath("/users/user[contains(translate(ID, '$uc', '$lc'), translate('$test', '$uc', '$lc'))]/lat"); $lons = $users->xpath("/users/user[contains(translate(ID, '$uc', '$lc') ,translate('$test', '$uc', '$lc'))]/lon"); Where $test = "NY:3036N-B" XML file contains NY:3036N-B and NY:3036N-B2 Thanks in advance, M

Member Avatar
Member Avatar
+0 forum 6

I would like to get Type, Id and Height values in database table. It is not working. There is no error message. Objective is to get RESPECTIVE "Type" from Catalaog which has same Reference from Installed. Well, I have 850 Mb XML file and i just would like to present small part of file: XML: <?xml version="1.0" encoding="utf-8"?> <Physical> <Catalog> <EquipmentSpec> <Reference>MAT_4</Reference> <Type>Duplexeur</Type> <Characteristic><CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>0</CharacteristicValue></Characteristic> </EquipmentSpec> <EquipmentSpec> <Reference>MAT_6890</Reference> <Type>Node</Type> <Characteristic><CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>2</CharacteristicValue></Characteristic> </EquipmentSpec> <EquipmentSpec> <Reference>MAT_50</Reference> <Type>Single</Type> <Characteristic><CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>5</CharacteristicValue></Characteristic> </EquipmentSpec> </Catalog> <Installed> <Equipment> <Id>26</Id><Reference>MAT_4</Reference> <Characteristic><CharacteristicName>Height</CharacteristicName><CharacteristicValue>160</CharacteristicValue></Characteristic> </Equipment> <Equipment> <Id>27</Id><Reference>MAT_6890</Reference> <Characteristic><CharacteristicName>Height</CharacteristicName><CharacteristicValue>140</CharacteristicValue></Characteristic> </Equipment> <Equipment> <Id>28</Id><Reference>MAT_50</Reference> <Characteristic><CharacteristicName>Height</CharacteristicName><CharacteristicValue>180</CharacteristicValue></Characteristic> </Equipment> </Installed> </Physical> Code: foreach ($xml->xpath('Physical') as $spec) { …

Member Avatar
Member Avatar
+0 forum 26

I would like to get **all** Equipment values. *I have used DOM Document.* It is reading **ONLY LAST Element**. *Equipment Id: 28*. I need all three. Thanks in advanced. XML File: <?xml version="1.0" encoding="UTF-8"?> -<Physical> <Catalog> </Catalog> -<Installed> -<Equipment> <Id>26</Id> <Ref>Tew12</Ref> -<Characteristic> <CharacteristicName>Height</CharacteristicName> <CharacteristicValue>160</CharacteristicValue> </Characteristic> -<Characteristic> <CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>30</CharacteristicValue> </Equipment> -<Equipment> <Id>27</Id> <Ref>Tew13</Ref> -<Characteristic> <CharacteristicName>Height</CharacteristicName> <CharacteristicValue>165</CharacteristicValue> </Characteristic> -<Characteristic> <CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>50</CharacteristicValue> </Equipment> -<Equipment> <Id>28</Id> <Ref>Tew14</Ref> -<Characteristic> <CharacteristicName>Height</CharacteristicName> <CharacteristicValue>190</CharacteristicValue> </Characteristic> -<Characteristic> <CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>50</CharacteristicValue> </Equipment> </Installed> </Physical> Expected Result: Id 26 Tilt 30 Id 27 Tilt 50 Id 28 Tilt 50 CODE: http://www.daniweb.com/web-development/php/threads/458094/how-to-get-nodevalue-with-xpathxmlphp

Member Avatar
Member Avatar
+0 forum 21

I would like to get name of Tilt and its value 30. I am not able to get the value of Tilt. Let me know if you have any idea. Thanks in advanced. XML File: <?xml version="1.0" encoding="UTF-8"?> -<Physical> <Catalog> </Catalog> -<Installed> -<Equipment> <Id>26</Id> <Ref>Tew12</Ref> -<Characteristic> <CharacteristicName>Height</CharacteristicName> <CharacteristicValue>160</CharacteristicValue> </Characteristic> -<Characteristic> <CharacteristicName>Tilt</CharacteristicName> <CharacteristicValue>30</CharacteristicValue> </Equipment> </Installed> </Physical> Expected Result: Id 26 Tilt 30 Code: /* For Id */ $Idquery = $xml->xpath("/Physical/Installed/Equipment/Id"); foreach ($Idquery as $Id) { print($Idquery->nodeValue); } /* For Tilt */ $XMLResults = $xml->xpath("/Physical/Installed/Equipment"); foreach($XMLResults as $item) { $Tilt = $item->xpath('//Characteristic[@CharacteristicName="Tilt"]'); print($Tilt->nodeValue); }

Member Avatar
Member Avatar
+0 forum 8

Hi, I am having a problem regarding the return statment, for some reason it is not working, can someone please tell me what i am doing wrong? The return is taking a selection of table collumns not all e.g. the simple return all "return $x" Thanks for $x in doc("Suppliers.xml")/dataroot/Suppliers[Country != "France"] return $x/SupplierID $x/CompanyName $x/ContactName $x/ContactTitle $x/Address $x/City $x/Country

Member Avatar
Member Avatar
+0 forum 5

I am just learning Xpath. How to mix 2 or more xpath validtions into a single line. On my page, I have 2 different tables under hthe //body tag. I want to validate two td s that exist on these 2 different tables. IsElementPresent is my own method. It uses Xpath. field.IsElementPresent("//td[text()='End']"); field.IsElementPresent("//span[text()='variables']"); I tried [//td[text()='End'] and //span[text()='variables'] ]. This is failed.

Member Avatar
Member Avatar
+0 forum 1

how to get the data from the following `xml`: <HostipLookupResultSet version="1.0.1" xsi:noNamespaceSchemaLocation="http://www.hostip.info/api/hostip-1.0.1.xsd"> <gml:description>This is the Hostip Lookup Service</gml:description> <gml:name>hostip</gml:name> <gml:boundedBy> <gml:Null>inapplicable</gml:Null> </gml:boundedBy> <gml:featureMember> <Hostip> <ip>182.0.0.1</ip> <gml:name>Private</gml:name> <countryName>Private</countryName> <countryAbbrev>PR</countryAbbrev> <!-- Co-ordinates are available as lng,lat --> <ipLocation> <gml:pointProperty><gml:Point srsName="http://www.abc.net/xyz/srs/epsg.xml#4326"> <gml:coordinates>68.7833,30.4</gml:coordinates> </gml:Point></gml:pointProperty> </ipLocation> </Hostip> </gml:featureMember> </HostipLookupResultSet> following is what i was trying: $userIpAddr = "test.xml"; $ipLink= new SimpleXMLElement($userIpAddr, NULL, TRUE); $user_ip = $ipLink->xpath("/HostipLookupResultSet/Hostip/ip"); $user_country = $ipLink->xpath("/HostipLookupResultSet/Hostip/countryName"); foreach($user_ip as $ip) { foreach($user_country as $country) { echo $ip.'<br/>'; echo $country.'<br/>'; } } is this a correct way to access the data?? if isn't then please suggest me the way to access the asked data...

Member Avatar
Member Avatar
+0 forum 3

hi to all m lil bit confuse as m beginner to the xml+xpath. so m sorry if i m unable to ask any kind of wrong question. now the question is m trying to accessing the name of the of the attribute of xml file using xpath and tyring to print it on the screen using php but m unable to do... here is the xml statement for which m trying <product> <price currency="EUR">9.95</price> <productURL>http://www.example.com</productURL> <imageURL>http://www.example.com/store/images/products/medium/9789033634628.jpg</imageURL> <description>Not Available</description> <categories> <category path="Nederlands / Religie &amp; Spiritualiteit / Religie /"></category> </categories> </product> as i want to print out the following attribute name: …

Member Avatar
Member Avatar
+0 forum 2

Hi, Can someone help me on this. Really appreciated. **Requirement:** 1. To generate separate html files for each pal:fragment element, for the source document attached ,the files gets name based on @fragment-id which is present on the pal:fragment elements. 2. The <pal:fragment> can be nested, wrapped with<div> element. 3. The fragmented file not only should include all child elements of pal:fragment, but also should include its ancestor <div> element. Each separate file generated from <pal:fragment should not include the content of its descendant <pal:fragment content. See below examples for requirement understanding *example1*: if a fragment file is generated for <pal:fragment …

Member Avatar
+0 forum 0

Hello , I'm trying to solve a "known problem" in XPath 1.0 . From [msdn](http://msdn.microsoft.com/en-us/library/bb341675.aspx) : "***Although the ordering of returned collections is not specified in the XML XPath Language 1.0 Recommendation, this extension method returns nodes in document order. Note that nodes are returned in document order even when you use a reverse axis, such as preceding-sibling or ancestor-or-self***." I've been given the pleasure to fix it :) So basically ,as you can see ,Java returns the nodes in a mixed order , by the order of the nodes in the XML file , but what I need is …

Member Avatar
+0 forum 0

Hi, I have problem with evaluating XPath with query. When I use this in xpath_tester script: [B]URL: [url]http://www.seznam.cz[/url][/B] [B]XPath: //*[@id='gadget-6']/div/div/h3/span[1][/B] Works fine, but this: [B]URL: [url]http://www.seznam.cz[/url][/B] [B]XPath: //*[@id='gadget-1']/div/div/div/div/table/tbody/tr[1]/td/div/div/strong/a[/B] Result: "ERROR 2: No result!", because there are no items in $nodeList I'm 100% sure XPath is OK. (using XPath checker extension for firefox) Here is code of xpath_tester.php: [CODE]<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>XPath tester</title> </head> <body> <?php if (isset($_POST['xpath']) && isset($_POST['url'])) { $url = $_POST['url']; $xpath = $_POST['xpath']; $doc = new DOMDocument(); @$doc->loadHTMLFile($url); $xp = new DOMXPath($doc); $nodeList = $xp->query($xpath); if ($nodeList != FALSE) { if ($nodeList->length …

Member Avatar
+0 forum 0

This thread is related to my thread on Java's forum: [url]http://www.daniweb.com/software-development/java/threads/408377[/url] I don't mean to make multiple posts but I wasn't sure which of these forums this problem belongs to. I will focus on asking about the XPath part here. I have a problem to understand XPath when it comes to nested statements. For example, if I want to select the driver in a green car on a wet road, when xml tags are nested in the order of <Road><Car><Driver>. I have a hard time to figure out the XPath syntax. For example, when do I have to use Road/Name['string'] …

Member Avatar
+0 forum 0

I spent about 4 hours trying to make PMD being able to validate my Java code but XPath proved to be very painful to work with when developing fairly original custom rules. My rule requires me to apply them only to methods without 'get' as part of their name. In another words, my rules need to apply to only non-getter methods in the class. I know to get a hold of all the non-getter methods, I can use //MethodDeclarator[not(contains(@Image,'get'))] [B]However, I don't know the syntax about where I insert my logic for the rules. Is it like [/B] //MethodDeclarator[ not(contains(@Image,'get')) …

Member Avatar
+0 forum 0

Hello everyone, I am studying XML, XPath, XQuery, XSLT on my own and I want to sharpen my skills working on opensource projects. I am searching on Apache and other websites but the projects are too huge and in much advanced stage to start working on. I want to get your opinions regarding this: Can you recommend any projects which i can contribute in. Is working on an opensource project to build expertise a right direction. thanks for your replies.

Member Avatar
Member Avatar
+0 forum 1

1. I want to take unique district values from the below xml. How to do it in XPATH? 2. I want to take unique taluk values and district name="xyz". what is the xpath expression? XML structure: <?xml version="1.0" encoding="utf-8"?> <imageData> <row> <slno>1</slno> <sitecode>001</sitecode> <sitename>Mel Sittamur</sitename> <photono>001_001_001.jpg</photono> <photodate>07-09-2008</photodate> <district>Villupuram</district> <taluk>Senji</taluk> <monument><![CDATA[Jain Temple, Sri Parsvanadha]]></monument> <subject><![CDATA[Tower]]></subject> <description><![CDATA[Yet to Provide the data ]]></description> </row> <row> <slno>2</slno> <sitecode>001</sitecode> <sitename>Mel Sittamur</sitename> <photono>001_001_002.jpg</photono> <photodate>07-09-2008</photodate> <district>Villupuram</district> <taluk>Senji</taluk> <monument><![CDATA[Jain Temple, Sri Parsvanadha]]></monument> <subject><![CDATA[Tower detail]]></subject> <description><![CDATA[Yet to Provide the data ]]></description> </row> <row> <slno>3</slno> <sitecode>001</sitecode> <sitename>Mel Sittamur</sitename> <photono>001_001_003.jpg</photono> <photodate>07-09-2008</photodate> <district>xyz</district> <taluk>Senji</taluk> <monument><![CDATA[Jain Temple, Sri Parsvanadha]]></monument> <subject><![CDATA[Saraswati]]></subject> <description><![CDATA[Yet to Provide …

Member Avatar
Member Avatar
+0 forum 8

Hi guys ! A little something i hope you could help me with - I've converted an html to XML and now i want to get all the child nodes nested within a DIV element with a specific attribute (class="itemInfo"). Because the html that the XML is based on changes from time to time i want to use a more "safe" relative root, (something like : "//div[@class='itemInfo']"). Problem is that i always get 0 nodes ... I'm sure that something is wrong with my Xpath syntax, just don't know what it is. Here is my code, please, any help would …

Member Avatar
Member Avatar
+0 forum 3

Hello to all ! Sorry in advance for the long post. I'm trying to get the value of a specific <div> from an html. This div has a class attribute of "itemPrice6", but problem is that this class appears few more times for other <div>s in which i'm not interested in. Best thing for me is if i am able to access the needed <div> using something like XPATH so i can target only those i need. I've been trying anything i could think of this past week but nothing seems to work. I'm an amateur programmer, so i might …

Member Avatar
+0 forum 0

Hello, I have a PHP file that lists a Post Code variable ($thisPostcode). Using simpleXML I need to compare the value of the Post Code variable to the Post Code attribute in an xml document, if there is a match I need it to echo the statement below if not do nothing. It all works fine as long as there is a valid match in the xml file, but if there is no match then I get the following error "Fatal error: Call to a member function attributes() on a non-object... " Any help would be great. Thanks [code=php] $xml …

Member Avatar
+0 forum 0

I have the following XPath expression written in Java: [CODE] " pProbs = XPath.newInstance(/n-grams-sorted/n-gram[contains(.,"+content1+") or contains(.,"+content2+") or contains(.,"+content3+") or contains(.,"+content4+") or contains(.,"+content5+")]/@probability"); [/CODE] My problem is that not all of the contains() expressions return true. What I need is: If one of them returns 'false' (i.e.: there are no nodes containing pattern 'x y z'), then Java must output a '0'. Seems simple enough, but I can't come up with a solution for this. Any ideas? Thanks

Member Avatar
Member Avatar
+0 forum 2

I am trying to run this XPath expression (that is, trying to count how many element content strings in my XML file end with letter-one-f ('a') or letter-two-f ('A'): [code=xslt]<xsl:value-of select="count( substring(.,string-length(.) -1,string-length(.) -1)=$letter-one-f or substring(., string-length(.) -1,string-length(.) -1)=$letter-two-f )"/>[/code] but I don't know how to refer to the 'current value'. All I know is that it's usually represented by a dot '.' . I don't know where to put 'template match' or if that is even needed. This code, on the other hand, works, because I have specified that it should look in '/n-grams-sorted/n-gram': [code=xslt]<xsl:value-of select="count(/n-grams-sorted/n-gram[starts-with(.,$letter-one-f) or starts-with(.,$letter-two-f) ])"/>[/code] …

Member Avatar
Member Avatar
+0 forum 2

Hi, we are using the XML Template of MS Word, and trying to use XPath(in a tool not code, but the same is not working in code also) to read the data from the xml file. attached the sample code, xml file and the XSD used to generate the word template. programeticlly we are using java w3c dom when trying the xpath "//w:customXml" it is returning 0 nodes, but when trying with getElementsByTagName("w:customXml") it is correctly returning 4 nodes. please help in getting the values using a xPath...

Member Avatar
+0 forum 0

[B]How do I get the value of a node with XPath?[/B] Get all nodes which have a price above 35 [COLOR="Green"]/bookstore/book[price>35.00][/COLOR] But when I change the > to an = for equals, the query fails. Please help. By the way I'm using php, but that shouldn't matter as XPath is universal. Here's the php code and xml code I was using [CODE]$xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> <bookstore> <book> <title lang=\"eng\">Harry Potter</title> <price>29.99</price> </book> <book> <title lang=\"eng\">Learning XML</title> <price>39.95</price> </book> </bookstore>"; $xml = new SimpleXMLElement($xml); $name = 'Shiny Red'; $nodes = $xml->xpath(sprintf('/bookstore/book[price>35.00]', $name)); if (!empty($nodes)) { printf('At least one building named …

Member Avatar
Member Avatar
+0 forum 1

The End.