Skip to content

Instantly share code, notes, and snippets.

@alanivey
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanivey/334c416e622128384299 to your computer and use it in GitHub Desktop.
Save alanivey/334c416e622128384299 to your computer and use it in GitHub Desktop.
libxml-ruby-1.1.3 for libxml2-2.9
diff --git a/vendor/gems/libxml-ruby-1.1.3/ext/libxml/ruby_xml_node.c b/vendor/gems/libxml-ruby-1.1.3/ext/libxml/ruby_xml_node.c
index ed058d2..7c48017 100644
--- a/vendor/gems/libxml-ruby-1.1.3/ext/libxml/ruby_xml_node.c
+++ b/vendor/gems/libxml-ruby-1.1.3/ext/libxml/ruby_xml_node.c
@@ -571,10 +571,17 @@ static VALUE rxml_node_to_s(int argc, VALUE *argv, VALUE self)
xmlNodeDumpOutput(output, xnode->doc, xnode, level, indent, xencoding);
xmlOutputBufferFlush(output);
+#ifdef LIBXML2_NEW_BUFFER
+ if (output->conv)
+ result = rxml_new_cstr((const char*) xmlBufContent(output->conv), xencoding);
+ else
+ result = rxml_new_cstr((const char*) xmlBufContent(output->buffer), xencoding);
+#else
if (output->conv)
result = rb_str_new2((const char*) output->conv->content);
else
result = rb_str_new2((const char*) output->buffer->content);
+#endif
xmlOutputBufferClose(output);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment