ext/xml/ruby_xml_parser.c in libxml-ruby-0.3.8.4 vs ext/xml/ruby_xml_parser.c in libxml-ruby-0.5.0
- old
+ new
@@ -1,7 +1,7 @@
-/* $Id: ruby_xml_parser.c,v 1.5 2006/11/20 01:22:07 roscopeco Exp $ */
-/* $Id: ruby_xml_parser.c,v 1.5 2006/11/20 01:22:07 roscopeco Exp $ */
+/* $Id: ruby_xml_parser.c 138 2007-08-29 18:00:35Z danj $ */
+/* $Id: ruby_xml_parser.c 138 2007-08-29 18:00:35Z danj $ */
/* Please see the LICENSE file for copyright and distribution information */
#include <stdarg.h>
#include "libxml.h"
@@ -1105,11 +1105,11 @@
* it's content. If an error occurs, XML::Parser::ParseError
* is thrown.
*/
VALUE
ruby_xml_parser_parse(VALUE self) {
- ruby_xml_document *rxd;
+ ruby_xml_document_t *rxd;
ruby_xml_parser *rxp;
ruby_xml_parser_context *rxpc;
xmlDocPtr xdp;
VALUE doc;
@@ -1134,14 +1134,11 @@
rb_raise(eXMLParserParseError, "Document did not contain well-formed XML");
} else {
rxp->parsed = 1;
}
- doc = ruby_xml_document_new(cXMLDocument, xdp);
- Data_Get_Struct(doc, ruby_xml_document, rxd);
- rxd->is_ptr = 0;
- rxd->doc = xdp;
+ doc = ruby_xml_document_wrap(cXMLDocument, xdp);
break;
default:
rb_fatal("Unknown data type, %d", rxp->data_type);
}
@@ -1214,10 +1211,10 @@
rxp->ctxt = ruby_xml_parser_context_new3();
data = (rx_string_data *)rxp->data;
data->str = str;
Data_Get_Struct(rxp->ctxt, ruby_xml_parser_context, rxpc);
- rxpc->ctxt = xmlCreateMemoryParserCtxt(StringValuePtr(data->str), RSTRING(data->str)->len);
+ rxpc->ctxt = xmlCreateMemoryParserCtxt(StringValuePtr(data->str), RSTRING_LEN(data->str));
return(data->str);
}
/*