有人可以指导我修复此查询的错误:
var objApps = from item in xDoc.Descendants("VHost")
where(from x in item.Descendants("Application"))
select new clsApplication
{
ConnectionsTotal = item.Element("ConnectionsTotal").Value
};
它显示编译器错误“查询主体必须以选择子句或组子句结尾”。我哪里错了?
将不胜感激任何帮助..
谢谢。
编辑:这是我的 XML(这里没有关闭标签)...我需要应用程序中的连接计数值..
- <Server>
<ConnectionsCurrent>67</ConnectionsCurrent>
<ConnectionsTotal>1424182</ConnectionsTotal>
<ConnectionsTotalAccepted>1385091</ConnectionsTotalAccepted>
<ConnectionsTotalRejected>39091</ConnectionsTotalRejected>
<MessagesInBytesRate>410455.0</MessagesInBytesRate>
<MessagesOutBytesRate>540146.0</MessagesOutBytesRate>
- <VHost>
<Name>_defaultVHost_</Name>
<TimeRunning>5129615.178</TimeRunning>
<ConnectionsLimit>0</ConnectionsLimit>
<ConnectionsCurrent>67</ConnectionsCurrent>
<ConnectionsTotal>1424182</ConnectionsTotal>
<ConnectionsTotalAccepted>1385091</ConnectionsTotalAccepted>
<ConnectionsTotalRejected>39091</ConnectionsTotalRejected>
<MessagesInBytesRate>410455.0</MessagesInBytesRate>
<MessagesOutBytesRate>540146.0</MessagesOutBytesRate>
- <Application>
<Name>TestApp</Name>
<Status>loaded</Status>
<TimeRunning>411642.953</TimeRunning>
<ConnectionsCurrent>11</ConnectionsCurrent>
<ConnectionsTotal>43777</ConnectionsTotal>
<ConnectionsTotalAccepted>43135</ConnectionsTotalAccepted>
<ConnectionsTotalRejected>642</ConnectionsTotalRejected>
<MessagesInBytesRate>27876.0</MessagesInBytesRate>
<MessagesOutBytesRate>175053.0</MessagesOutBytesRate>