From 759def2852b3de99956ff800a847c8dcb0df4f28 Mon Sep 17 00:00:00 2001 From: Dominique Broeglin Date: Mon, 19 Mar 2012 12:04:36 +0100 Subject: [PATCH] take xsi:type="xsd:base64Binary" attributes into account --- lib/nori/xml_utility_node.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/nori/xml_utility_node.rb b/lib/nori/xml_utility_node.rb index 34c31be..d42629b 100644 --- a/lib/nori/xml_utility_node.rb +++ b/lib/nori/xml_utility_node.rb @@ -73,6 +73,17 @@ def initialize(nori, name, normalized_attributes = {}) # leave the type alone if we don't know what it is @type = self.class.available_typecasts.include?(attributes["type"]) ? attributes.delete("type") : attributes["type"] + unless @type + val = attributes["xsi:type"] + val.gsub!(/^.*:/, '') if val + if self.class.available_typecasts.include?(val) + attributes.delete("xsi:type") + @type = val + else + @type = attributes["xsi:type"] + end + end + @nil_element = false attributes.keys.each do |key| if result = /^((.*):)?nil$/.match(key)