我需要从Output\OutputFields\OutputField
列的所有SPEC
中获取“名称”字段的值。
create table T
(
ID uniqueidentifier default newid(),
SPEC xml
);
insert into T (SPEC)
values (N'<QueryViewSpec xmlns="bb_appfx_queryview" xmlns:common="bb_appfx_commontypes">
<Output>
<OutputFields>
<OutputField Caption="Key name prefix" Name="KEYNAMEPREFIX" CaptionResourceKey="$$key_name_prefix" />
<OutputField Caption="Number of employees" Name="NUMEMPLOYEES" CaptionResourceKey="$$number_of_employees" />
<OutputField Caption="Number of subsidiaries" Name="NUMSUBSIDIARIES" CaptionResourceKey="$$number_of_subsidiaries" />
<OutputField Caption="Parent corporation ID" IsHidden="true" Name="PARENTCORPID" />
<OutputField Caption="Is organization" Name="ISORGANIZATION" CaptionResourceKey="$$is_organization" />
<OutputField Caption="Last/Organization/Group/Household name" Name="KEYNAME" CaptionResourceKey="$$last/organization/group/household_name" />
<OutputField Caption="First name" Name="FIRSTNAME" CaptionResourceKey="$$first_name" />
<OutputField Caption="Middle name" Name="MIDDLENAME" CaptionResourceKey="$$middle_name" />
<OutputField Caption="Maiden name" Name="MAIDENNAME" CaptionResourceKey="$$maiden_name" />
<OutputField Caption="Nickname" Name="NICKNAME" CaptionResourceKey="$$nickname" />
<OutputField Caption="Lookup ID" Name="LOOKUPID" CaptionResourceKey="$$lookup_id" />
</OutputFields>
</Output>
</QueryViewSpec>')
select * from T
;with xmlnamespaces ('bb_appfx_queryview' as ns)
select
R.c.value('@Name', 'varchar(max)')
from
T
outer apply
SPEC.nodes('ns:QueryViewSpec/Output/OutputFields/OutputField') as R(c)
drop table T;
我想念什么?我尝试过使用和不使用命名空间都没有运气。
答案 0 :(得分:0)
您需要通过指定名称空间前缀exports.switchWindowFocus = function (url) {
var self = this;
browser.getAllWindowHandles().then(function (handles) {
browser.wait(self.windowCount(2), 10000);
browser.switchTo().window(handles[1]).then(function(){
expect(browser.getCurrentUrl()).toEqual(url);
})
});
};
(并且我还将使用ns:
),将已定义的XML名称空间应用到XPath表达式中-试试这个:
CROSS APPLY
或者,或者-您需要将XML名称空间定义为默认名称空间-像这样:
;WITH xmlnamespaces ('bb_appfx_queryview' AS ns)
SELECT
R.c.value('@Name', 'VARCHAR(MAX)')
FROM
T
CROSS APPLY
SPEC.nodes('/ns:QueryViewSpec/ns:Output/ns:OutputFields/ns:OutputField') as R(c)