lib/xml/mixup.rb in xml-mixup-0.1.0 vs lib/xml/mixup.rb in xml-mixup-0.1.1

- old
+ new

@@ -110,25 +110,25 @@ # handle adjacent node declaration adj = nil ADJACENT.keys do |k| if nodes[k] if adj - raise + raise "Cannot bind to #{k}: #{adj} is already present" end unless nodes[k].is_a? Nokogiri::XML::Node - raise + raise "#{k} must be an XML node" end adj = k end end # generate doc/parent if adj doc ||= nodes[adj].document unless adj == 'parent' unless (nodes[:parent] = nodes[adj].parent) - raise + raise "#{adj} node must have a parent node!" end end else doc ||= Nokogiri::XML::Document.new nodes[adj = :parent] ||= doc @@ -220,11 +220,11 @@ ADJACENT[adj].call node, nodes[adj] elsif name == '#pi' or name == '#processing-instruction' # now processing instructions if children.empty? - raise + raise "Processing instruction must have at least a target" end target = children[0] content = '' if (c = children[1..children.length]) and c.length > 0 #warn c.inspect @@ -243,21 +243,21 @@ ADJACENT[adj].call node, nodes[adj] elsif name == '#dtd' or name == '#doctype' # now doctype declarations if children.empty? - raise + raise "DTD node must have a root element declaration" end # assign as if these are args root, pub, sys = children # supplant with attributes if present pub ||= attr[:public] if attr[:public] sys ||= attr[:system] if attr[:system] # XXX for some reason this is an *internal* subset? - node = doc.create_internal_subset(root, pub, sys) + node = doc.create_internal_subset(root, pub.to_s, sys.to_s) # at any rate it doesn't have to be explicitly attached # attach it to the document #doc.add_child node @@ -317,11 +317,11 @@ ns.delete(nil) end # there should be no nil namespace declarations now if ns.has_value? nil - raise + raise 'INTERNAL ERROR: nil namespace declaration' end # generate the node node = element name, doc: doc, ns: ns, attr: at, args: args @@ -464,10 +464,10 @@ end private def element tag, doc: nil, ns: {}, attr: {}, args: [] - raise unless doc + raise 'Document node must be present' unless doc prefix = local = nil if tag.respond_to? :to_a prefix, local = tag tag = tag.join ':' end