【发布时间】:2014-08-11 03:33:43
【问题描述】:
我将如何解析以下内容,它至少不会改变行的布局。所以我需要能够获取查询参数值,即 TypeProjectionId 以及 Name=? 的值。有人有什么想法吗?
我正在使用它从 xml 文件中获取文本。
string path = "/View/Data/ItemsSource";
XmlNodeList nodeList = currentDocument.SelectNodes(path);
IDictionary<string, string> keyValuePairList = new Dictionary<string, string>();
string itemsource;
itemsource = "";
foreach (XmlNode node in nodeList)
{
itemsource = node.InnerXml;
// keyValuePairList.Add(new KeyValuePair<string, string>(node.Attributes[0].Value, node.Attributes[0].Value));
}
itemsource的结果
<AdvancedListSupportClass xmlns=\"clr-namespace:Microsoft.EnterpriseManagement.UI.ViewFramework;assembly=Microsoft.EnterpriseManagement.UI.ViewFramework\" xmlns:av=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:s=\"clr-namespace:System;assembly=mscorlib\" DataTypeName=\"\" AdapterName=\"viewframework://Adapters/AdvancedList\" FullUpdateAdapter=\"dataportal:EnterpriseManagementObjectProjectionAdapter\" DataSource=\"mom:ManagementGroup\" IsRecurring=\"True\" RecurrenceFrequency=\"{x:Static s:Int32.MaxValue}\" FullUpdateFrequency=\"1\" Streaming=\"true\">
<AdvancedListSupportClass.Parameters>
<QueryParameter Parameter=\"TypeProjectionId\" Value=\"$MPElement[Name='System.WorkItem.Incident.View.ProjectionType']$\" />
</AdvancedListSupportClass.Parameters>
</AdvancedListSupportClass>
【问题讨论】:
-
问题中的标点符号会有所帮助
-
一个像样的问题标题也会有所帮助
-
那么你想获取一个节点的属性值吗?尝试这个! stackoverflow.com/questions/933687/…
-
是的,这是正确的,@DavidS。对不起,我有拼写障碍