xml_resource 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/xml_resource/base.rb +5 -2
- data/lib/xml_resource/version.rb +2 -2
- metadata +1 -1
data/lib/xml_resource/base.rb
CHANGED
@@ -2,7 +2,7 @@ module XmlResource
|
|
2
2
|
class Base
|
3
3
|
TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE', 'on', 'ON'].to_set
|
4
4
|
|
5
|
-
class_attribute :attributes, :collections, :objects, :root_path
|
5
|
+
class_attribute :attributes, :collections, :objects, :root_path, :remove_namespaces
|
6
6
|
self.attributes = {}
|
7
7
|
self.collections = {}
|
8
8
|
self.objects = {}
|
@@ -146,7 +146,10 @@ module XmlResource
|
|
146
146
|
def parse(xml_or_string)
|
147
147
|
case xml_or_string
|
148
148
|
when Nokogiri::XML::Node, Nokogiri::XML::NodeSet then xml_or_string
|
149
|
-
when String
|
149
|
+
when String
|
150
|
+
xml = Nokogiri.XML(xml_or_string)
|
151
|
+
xml.remove_namespaces! if remove_namespaces
|
152
|
+
xml.root
|
150
153
|
else
|
151
154
|
raise XmlResource::ParseError, "cannot parse #{xml_or_string.inspect}"
|
152
155
|
end
|
data/lib/xml_resource/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module XmlResource
|
2
|
-
VERSION = '2.0.
|
3
|
-
end
|
2
|
+
VERSION = '2.0.1'
|
3
|
+
end
|