我正在使用linq to xml和xpath来获取具有特定属性和特定值的元素的出现次数....这是我的xml文件... 在这个我必须提取元素p的出现次数与属性“HSDPACodeCapacity”和值5 ....这是一个非常长的文件所以我完全发布这个...帮助请.... ..i想用LINQ to xml来编程 “
<managedObject class="WBTS" version="RN6.0_2.0" distName="PLMN-PLMN/RNC-3003/WBTS-2743" id="214999014">
<defaults name="System"/>
<p name="DLCECapacity">0</p>
<p name="HSDPACodeCapacity">5</p>
<p name="ULCECapacity">0</p>
<p name="bburruFlag">0</p>
<p name="name">WHALANoO</p>
<p name="nbrRepeater">0</p>
<p name="numFa">1</p>
<p name="type">3</p>
<p name="BTSAdditionalInfo">150.78892:-33.76300</p>
<p name="BTSIPAddress">10.212.19.121</p>
<p name="BTSSupportForHSPACM">1</p>
<p name="COCOId">2743</p>
<p name="DCNLinkStatus">1</p>
<p name="DCNSecurityStatus">0</p>
<p name="DLORLAveragingWindowSize">0</p>
<p name="DSCPHigh">46</p>
<p name="DSCPLow">0</p>
<p name="DSCPMedDCH">34</p>
<p name="DediMeasRepPeriodCSdata">3</p>
<p name="DediMeasRepPeriodPSdata">1</p>
<p name="DedicatedMeasReportPeriod">5</p>
<p name="DelayThresholdMax">10000</p>
<p name="DelayThresholdMax2msTTI">10000</p>
<p name="DelayThresholdMid">7000</p>
<p name="DelayThresholdMid2msTTI">7000</p>
<p name="DelayThresholdMin">5000</p>
<p name="DelayThresholdMin2msTTI">5000</p>
<p name="HARQRVConfiguration">1</p>
<p name="HSDPA14MbpsPerUser">1</p>
<p name="HSDPACCEnabled">1</p>
<p name="HSDPAULCToDSCP">34</p>
<p name="HSUPADLCToDSCP">34</p>
<p name="HSUPAXUsersEnabled">60</p>
<p name="IPBasedRouteIdIub">0</p>
<p name="IPBasedRouteIdIub2">0</p>
<p name="IPNBId">0</p>
<p name="IntelligentSDPrioHO">0</p>
<p name="IubTransportMedia">0</p>
<p name="LoadControlPeriodPS">4</p>
<p name="MaxNumberEDCHLCG">80</p>
<p name="MeasFiltCoeff">4</p>
<p name="MinUDPPortIub">1026</p>
<p name="NBAPCommMode">0</p>
<p name="NESWVersion">WN7.0_1.0</p>
<p name="NEType">3</p>
<p name="NbrOfOverbookedHSDPAUsers">3</p>
<p name="PDUSize656WithHSDSCH">2</p>
<p name="PSAveragingWindowSize">5</p>
<p name="PSRLAveragingWindowSize">0</p>
<p name="ProbabilityFactorMax">1000</p>
<p name="ProbabilityFactorMax2msTTI">1000</p>
<p name="PrxAlpha">40</p>
<p name="PrxMeasAveWindow">20</p>
<p name="PrxTargetPSAdjustPeriod">10</p>
<p name="PtxAlpha">20</p>
<p name="PtxDPCHmax">-30</p>
<p name="PtxDPCHmin">-30</p>
<p name="PtxMeasAveWindow">20</p>
<p name="RACHloadIndicationPeriod">1</p>
<p name="RRIndPeriod">20</p>
<p name="RRMULDCHActivityFactorCSAMR">50</p>
<p name="RRMULDCHActivityFactorCSNTData">95</p>
<p name="RRMULDCHActivityFactorCSTData">100</p>
<p name="RRMULDCHActivityFactorPSBackgr">60</p>
<p name="RRMULDCHActivityFactorPSStream">95</p>
<p name="RRMULDCHActivityFactorPSTHP1">60</p>
<p name="RRMULDCHActivityFactorPSTHP2">60</p>
<p name="RRMULDCHActivityFactorPSTHP3">60</p>
<p name="RRMULDCHActivityFactorSRB">1</p>
<p name="ReleaseTimerForSharedHSDPAallocation">3</p>
<p name="SchedulingPeriod">200</p>
<p name="SharedHSDPAVCCSelectionMethod">0</p>
<p name="SharedHSDPAallocation">25</p>
<p name="ToAWEOffsetNRTDCHIP">5</p>
<p name="ToAWEOffsetRTDCHIP">0</p>
<p name="ToAWSOffsetNRTDCHIP">10</p>
<p name="ToAWSOffsetRTDCHIP">10</p>
<p name="WBTSChangeOrigin">2</p>
<p name="WBTSName">WHALANoO</p>
<p name="WinACRABsetupDL">5</p>
<p name="WinACRABsetupUL">5</p>
<p name="WinLCHSDPA">5</p>
<p name="WinLCHSUPA">5</p>
答案 0 :(得分:0)
这是你的XPATH来实现这个目标:
count(//p[@name='HSDPACodeCapacity'][.='5'])