lib/evertils/helpers/api-enml-handler.rb in evertils-0.3.23 vs lib/evertils/helpers/api-enml-handler.rb in evertils-0.3.24
- old
+ new
@@ -58,20 +58,21 @@
# lets replace it with a new DTD if that is the case
# @since 0.3.15
def fix_dtd
node = @xml.children[0]
+ # the node we are looking at is actually the XML node, skip it
if node.is_a?(ProcessingInstruction)
node = node.next
+ end
- # remove the existing broken DTD
- node.remove
- # create a new one (note: output is overridden in DTD class defined
- # below ApiEnmlHandler)
- dtd = DTD.new('DOCTYPE', @xml)
+ # remove the existing broken DTD
+ node.remove
+ # create a new one (note: output is overridden in DTD class defined
+ # below ApiEnmlHandler)
+ dtd = DTD.new('DOCTYPE', @xml)
- @xml.children.first.after(dtd)
- end
+ @xml.children.first.before(dtd)
end
#
# @since 0.3.1
def to_enml(hash)