我正在使用一个逻辑应用程序来解析和重新构造一个入站XML。我遇到的问题是,XML的一部分并不总是以相同的顺序包含相同数量的子节。所以我想知道是否可以根据类型返回值?也就是说,在本例中,我希望返回值2,其中2并不总是第二个上下文。
<ContextCollection>
<Context>
<Type>test1</Type>
<Value>1</Value>
</Context>
<Context>
<Type>test2</Type>
<Value>2</Value>
</Context>
<Context>
<Type>test3</Type>
<Value>3</Value>
</Context>
我已成功使用以下表达式xpath(xml(variables('XMLStripNameSpace')),'string(/*[name()="ContextCollection"]/*[name()="Context"][2]/*[name()="Value"])')
但当测试2是第三个Context
时,这显然不起作用。
此XPath,
//Context[Type = "test2"]/Value
将选择Type
test2
的Context
元素的所有Value
元素子项。
上一篇:VS2010 .NET内存分析 - 极其缓慢缓慢、内存、NET
下一篇:LINQ:如何申报的IEnumerable [AnonymousType]?LINQ、IEnumerable、AnonymousType