/* * call-seq: * serialize * * Serialize this document */ static VALUE serialize(VALUE self) { xmlDocPtr doc; xmlChar *buf; int size; Data_Get_Struct(self, xmlDoc, doc); xmlDocDumpMemory(doc, &buf, &size); VALUE rb_str = rb_str_new((char *)buf, (long)size); xmlFree(buf); return rb_str; }