Created
May 23, 2011 16:41
-
-
Save databus23/987019 to your computer and use it in GitHub Desktop.
nokogiri duplicate xpath results bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'nokogiri' | |
while true | |
doc=Nokogiri::XML(open('test.xml')) | |
xpath_query="//MetricTemplate[@name=\"Availability\" or @name=\"does not exist\"]" | |
puts "xpath: #{xpath_query}" | |
result = doc.xpath(xpath_query) | |
if result.length>1 | |
puts "duplicate:" | |
result.each {|b| puts b} | |
exit | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<MetricTemplatesResponse> | |
<Status>Success</Status> | |
<MetricTemplate id="10543" name="Availability" alias="Availability" units="percentage" plugin="system" indicator="true" defaultOn="true" collectionType="0" defaultInterval="300000" category="AVAILABILITY"/> | |
<MetricTemplate id="10547" name="Capacity" alias="Capacity" units="KB" plugin="system" indicator="false" defaultOn="false" collectionType="1" defaultInterval="1800000" category="UTILIZATION"/> | |
<MetricTemplate id="10534" name="Disk Queue" alias="DiskQueue" units="none" plugin="system" indicator="false" defaultOn="false" collectionType="0" defaultInterval="300000" category="THROUGHPUT"/> | |
<MetricTemplate id="10535" name="Disk Read Bytes" alias="DiskReadBytes" units="B" plugin="system" indicator="false" defaultOn="false" collectionType="2" defaultInterval="600000" category="THROUGHPUT"/> | |
<MetricTemplate id="10536" name="Disk Read Bytes per Minute" alias="DiskReadBytes1m" units="B" plugin="system" indicator="false" defaultOn="false" collectionType="0" defaultInterval="600000" category="THROUGHPUT"/> | |
<MetricTemplate id="10541" name="Disk Reads" alias="DiskReads" units="none" plugin="system" indicator="false" defaultOn="false" collectionType="2" defaultInterval="600000" category="THROUGHPUT"/> | |
<MetricTemplate id="10544" name="Disk Reads per Minute" alias="DiskReads1m" units="none" plugin="system" indicator="true" defaultOn="true" collectionType="0" defaultInterval="600000" category="THROUGHPUT"/> | |
<MetricTemplate id="10549" name="Disk Service Time" alias="DiskServiceTime" units="ms" plugin="system" indicator="false" defaultOn="false" collectionType="0" defaultInterval="300000" category="UTILIZATION"/> | |
<MetricTemplate id="10538" name="Disk Write Bytes" alias="DiskWriteBytes" units="B" plugin="system" indicator="false" defaultOn="false" collectionType="2" defaultInterval="600000" category="THROUGHPUT"/> | |
<MetricTemplate id="10537" name="Disk Write Bytes per Minute" alias="DiskWriteBytes1m" units="B" plugin="system" indicator="false" defaultOn="false" collectionType="0" defaultInterval="600000" category="THROUGHPUT"/> | |
<MetricTemplate id="10540" name="Disk Writes" alias="DiskWrites" units="none" plugin="system" indicator="false" defaultOn="false" collectionType="2" defaultInterval="600000" category="THROUGHPUT"/> | |
<MetricTemplate id="10545" name="Disk Writes per Minute" alias="DiskWrites1m" units="none" plugin="system" indicator="true" defaultOn="true" collectionType="0" defaultInterval="600000" category="THROUGHPUT"/> | |
<MetricTemplate id="10546" name="Free Files" alias="FreeFiles" units="none" plugin="system" indicator="false" defaultOn="false" collectionType="0" defaultInterval="300000" category="UTILIZATION"/> | |
<MetricTemplate id="10550" name="Total Bytes Avail" alias="TotFsAvail" units="KB" plugin="system" indicator="false" defaultOn="false" collectionType="0" defaultInterval="300000" category="UTILIZATION"/> | |
<MetricTemplate id="10533" name="Total Bytes Free" alias="TotFsFree" units="KB" plugin="system" indicator="true" defaultOn="true" collectionType="0" defaultInterval="300000" category="UTILIZATION"/> | |
<MetricTemplate id="10548" name="Total Bytes Used" alias="TotFsUsed" units="KB" plugin="system" indicator="false" defaultOn="false" collectionType="0" defaultInterval="300000" category="UTILIZATION"/> | |
<MetricTemplate id="10542" name="Total Files" alias="Files" units="none" plugin="system" indicator="false" defaultOn="false" collectionType="0" defaultInterval="300000" category="UTILIZATION"/> | |
<MetricTemplate id="10539" name="Use Percent" alias="UsePercent" units="percentage" plugin="system" indicator="true" defaultOn="true" collectionType="0" defaultInterval="300000" category="UTILIZATION"/> | |
</MetricTemplatesResponse> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment