lib/evertils/helpers/api-enml-handler.rb in evertils-0.3.20 vs lib/evertils/helpers/api-enml-handler.rb in evertils-0.3.21
- old
+ new
@@ -23,15 +23,11 @@
end
#
# @since 0.3.7
def convert_to_xml(enml)
- # remove the xml declaration and DTD
- enml = enml.split("\n")
- enml.shift(2)
-
- @xml = from_str(enml.join)
+ @xml = from_str(enml)
self
end
alias to_xml convert_to_xml
#
@@ -60,12 +56,12 @@
# Sometimes, the Doctype declaration gets borked by the XML parser
# lets replace it with a new DTD if that is the case
# @since 0.3.15
def fix_dtd
- if @xml.children.first.is_a?(Text)
+ if @xml.children[0].is_a?(Text)
# remove the existing broken DTD
- @xml.children.first.remove
+ @xml.children[0].remove
# create a new one (note: output is overridden in DTD class defined
# below ApiEnmlHandler)
dtd = DTD.new('DOCTYPE', @xml)
@xml.children.first.before(dtd)