On the first test, its a bug in the activesupport code:

      def to_hash(hash={})
        if text?
          raise LibXML::XML::Error if content.length >= LIB_XML_LIMIT
          hash[CONTENT_ROOT] = content # !!!!! INCORRECT !!!!!
        else

This is the xml:

<root>
good
<products>
hello everyone
</products>
morning
</root>

Look at the sequence of nodes as they are processed:

root
  text (child)
  element (products)
    text (hello everyone)
  text (morning)

When the text node (morning) is processed:

   hash[CONTENT_ROOT] = content

Thus overwriting the text "good" with "morning"

You want something more like this:

hash[CONTENT_ROOT] = (hash[CONTENT_ROOT] || '') + content


Charlie

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to