xpath

Inno Setup - XML editing XPath request fails with “NIL Interface Exception at runtime”

亡梦爱人 提交于 2020-08-25 07:27:08
问题 I've created a Inno Setup script for my app in which I'm trying to edit some XML configuration in the post install step (mostly connection strings). I have some pretty simple XPath request but I have a runtime exception when using selectSingleNode whereas getElementsByTagName works perfectly fine. This code does not work. It throws "NIL Interface Exception at runtime" . procedure ReadValueFromXML(const AFileName, APath, AAttribute, AValue: string); var XMLNode: Variant; XMLDocument: Variant;

sum of alternate numbers (XML/XSL)

≡放荡痞女 提交于 2020-08-25 05:03:10
问题 Need to add alternate digits in a number receiving from XML file using XSLT, for instance If I am receiving a 123456789, I need to calculate alternate digit sum from right most using XSLT function, can i have any suggestions on this ? Thanks, Laxmikanth.S 回答1: This is extremely easy to do with XSLT 2.0 (actually just with a single XPath 2.0 expression): The following XSLT transformation: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:output method="text"

Using not() in XPath

我与影子孤独终老i 提交于 2020-08-24 05:07:23
问题 I would like how to use the "not" in XPath properly. I just can't seem to get it to work with attributes. Say I have this expression: //*[@name = 'Bob'] It is valid, and will return all nodes that have a name attribute equaling 'Bob'. Now if I want all nodes that have a name attribute that do not equal 'Bob', I need to use an XPath such as: //*[@name not(='Bob')] but this is invalid. I have tried multiple combinations with not() being placed in a different order, but I can't seem to get this

Using not() in XPath

无人久伴 提交于 2020-08-24 05:06:27
问题 I would like how to use the "not" in XPath properly. I just can't seem to get it to work with attributes. Say I have this expression: //*[@name = 'Bob'] It is valid, and will return all nodes that have a name attribute equaling 'Bob'. Now if I want all nodes that have a name attribute that do not equal 'Bob', I need to use an XPath such as: //*[@name not(='Bob')] but this is invalid. I have tried multiple combinations with not() being placed in a different order, but I can't seem to get this

How to use logical operator in xpath expression

我只是一个虾纸丫 提交于 2020-08-23 07:05:29
问题 i wrote the beloww code to retrive the value of the attribuet v in the element tag by specifyin the lat and lon values as shown below. i think my mistake is related to the how i use the && operator in the xpath expression, because when i used String expr0 = "//node[@lat='53.334062']/following-sibling::tag[1]/@v"; i receive the expected value, but when i uesd the below posted expression, the system crashs but at run time, the program crashs and shows the below error message. code : String

How to use logical operator in xpath expression

半腔热情 提交于 2020-08-23 07:05:29
问题 i wrote the beloww code to retrive the value of the attribuet v in the element tag by specifyin the lat and lon values as shown below. i think my mistake is related to the how i use the && operator in the xpath expression, because when i used String expr0 = "//node[@lat='53.334062']/following-sibling::tag[1]/@v"; i receive the expected value, but when i uesd the below posted expression, the system crashs but at run time, the program crashs and shows the below error message. code : String

HTML XPath Searching by class and text

和自甴很熟 提交于 2020-08-22 07:11:02
问题 I want to find all elements in xpath by class and text. I have tried this but it does not work. //*[contains(@class, 'myclass')]//*[text() = 'qwerty'] I am trying to find all elements that have a class of 'myclass' and the text is 'qwert' (these will be span elements) 回答1: //span[contains(@class, 'myclass') and text() = 'qwerty'] or //span[contains(@class, 'myclass') and normalize-space(text()) = 'qwerty'] 回答2: Generic solution for anyone looking for a XPath expression to search based on

HTML XPath Searching by class and text

白昼怎懂夜的黑 提交于 2020-08-22 07:10:49
问题 I want to find all elements in xpath by class and text. I have tried this but it does not work. //*[contains(@class, 'myclass')]//*[text() = 'qwerty'] I am trying to find all elements that have a class of 'myclass' and the text is 'qwert' (these will be span elements) 回答1: //span[contains(@class, 'myclass') and text() = 'qwerty'] or //span[contains(@class, 'myclass') and normalize-space(text()) = 'qwerty'] 回答2: Generic solution for anyone looking for a XPath expression to search based on