我必须计算出现在 XML 中的每个无效数字 (BTNumber) 的出现次数。我正在使用 groovy XmlSlurper() 。请建议如何计算数字和计数(在 xml 中的多次)
例如-
BTNumber | count
----------------------------------
2205867438 | 2
78124614 | 3
XML代码如下 -
<Results>
<Row>
<DialedCountry>001</DialedCountry>
<BTNumber>2205867438
</BTNumber>
<CPNumber>0000000000</CPNumber>
<DialedNumber>2461253052</DialedNumber>
<Wireless>1</Wireless>
<CarrierCode>customer1</CarrierCode>
<DateStamp>2013-03-24 11:50:04.0</DateStamp>
</Row>
<Row>
<DialedCountry>001</DialedCountry>
<BTNumber>2205867438</BTNumber>
<CPNumber>0000000000</CPNumber>
<DialedNumber>2461253052</DialedNumber>
<Wireless>1</Wireless>
<CarrierCode>customer1</CarrierCode>
<DateStamp>2013-03-24 11:50:18.0</DateStamp>
</Row>
<Row>
<DialedCountry>001</DialedCountry>
<BTNumber>2201159526</BTNumber>
<CPNumber>0000000000</CPNumber>
<DialedNumber>1111253052</DialedNumber>
<Wireless>1</Wireless>
<CarrierCode>customer1</CarrierCode>
<DateStamp>2013-03-24 11:53:07.0</DateStamp>
</Row>
<Row>
<DialedCountry>001</DialedCountry>
<BTNumber>1011159526</BTNumber>
<CPNumber>0000000000</CPNumber>
<DialedNumber>1111253052</DialedNumber>
<Wireless>1</Wireless>
<CarrierCode>customer1</CarrierCode>
<DateStamp>2013-03-24 11:53:18.0</DateStamp>
</Row>
</Results>
<Results>
<Row>
<DialedCountry>001</DialedCountry>
<BTNumber>78124614</BTNumber>
<CPNumber>78124614</CPNumber>
<DialedNumber>7812461400</DialedNumber>
<Wireless>1</Wireless>
<CarrierCode>MyNetwork</CarrierCode>
<DateStamp>2013-03-24 10:18:50.0</DateStamp>
</Row>
<Row>
<DialedCountry>001</DialedCountry>
<BTNumber>78124614</BTNumber>
<CPNumber>78124614</CPNumber>
<DialedNumber>7812461400</DialedNumber>
<Wireless>1</Wireless>
<CarrierCode>MyNetwork</CarrierCode>
<DateStamp>2013-03-24 15:35:31.0</DateStamp>
</Row>
<Row>
<DialedCountry>001</DialedCountry>
<BTNumber>78124614</BTNumber>
<CPNumber>78124614</CPNumber>
<DialedNumber>7812461400</DialedNumber>
<Wireless>1</Wireless>
<CarrierCode>MyNetwork</CarrierCode>
<DateStamp>2013-03-24 15:36:59.0</DateStamp>
</Row>
</Results>
请建议是否有比 XMLSlurper 更容易和更快的方法。