Created
July 20, 2016 20:09
-
-
Save djberg96/9bd301987a328ce693c50eb237e88721 to your computer and use it in GitHub Desktop.
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 'nokogiri' | |
require 'oga' | |
xml = %Q{<?xml version="1.0" encoding="utf-8"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>true</Enabled><IncludeAPIs>true</IncludeAPIs><RetentionPolicy><Enabled>true</Enabled><Days>7</Days></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors /></StorageServiceProperties>} | |
top = "StorageServiceProperties" | |
p Nokogiri::XML(xml).xpath("//#{top}").to_s # => "<StorageServiceProperties>\n <Logging>\n ..., etc | |
p Oga.parse_xml(xml).xpath("//#{top}").to_s # => "#<Oga::XML::NodeSet:0x007fb0e3910280>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment