我正在尝试从每个XML节点提取所有值。例如,对于<Cash>
节点,我想恢复值(0,1),但无法获取
CREATE TABLE #TableXML (Col1 INT PRIMARY KEY, Col2 XML)
INSERT INTO #TableXML
VALUES (1,
'<CookedUP>
<Evenement Calcul="16">
<Cookie xmlns="http://services.ariel.morneausobeco.com/2007/02" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<AlternateOptionTypeCodes />
<Cash>0</Cash>
<CashInterest>0</CashInterest>
<CashSource>Undefined</CashSource>
<Code>A</Code>
<SmallAmount>0</SmallAmount>
<SmallAmountType>Undefined</SmallAmountType>
</Cookie>
<Cookie xmlns="http://services.ariel.morneausobeco.com/2007/02" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<AlternateOptionTypeCodes />
<Cash>1</Cash>
<CashInterest>2</CashInterest>
<CashSource>Undefined</CashSource>
<Code>B</Code>
<SmallAmount>1</SmallAmount>
<SmallAmountType>1</SmallAmountType>
</Cookie>
</Evenement>
</CookedUP> '
)
WITH XMLNAMESPACES ('http://services.ariel.morneausobeco.com/2007/02' AS ns)
SELECT
b.Col1,
x.XmlCol.value('(ns:Cookie/ns:SmallAmount/text())[2]', 'int') AS SmallAmount,
x.XmlCol.value('(ns:Cookie/ns:Cash/text())[2]', 'int') AS Cash
FROM
#TableXML b
CROSS APPLY
b.Col2.nodes('CookedUP/Evenement') x(XmlCol);
答案 0 :(得分:0)
对您已经拥有的内容进行小的调整,就可以了。 直到Cookie节点,命名空间才起作用。
我将示例更新为表变量,尝试一下:
$searchBtnIris2 = $driver.FindElementByXPath('//*[@id="menuFormHome:j_id44_body"]/ul[3]/li[1]/a')
Write-Host "Den ID van de zoekknop is $seachBtnIris2"
$searchBtnIris2.Click();