0
@@ -13,11 +13,12 @@ VALUE fastxml_doc_inspect(VALUE self)
0
argv = ALLOCA_N( VALUE, 3 );
0
- argv[0] = rb_str_new2( "#<%s:0x%x
>" );
0
+ argv[0] = rb_str_new2( "#<%s:0x%x
%s>" );
0
argv[1] = CLASS_OF( self );
0
argv[2] = rb_obj_id( self );
0
+ argv[3] = fastxml_doc_to_s( self );
0
- return rb_f_sprintf(
3, argv );
0
+ return rb_f_sprintf(
4, argv );
0
VALUE fastxml_doc_children(VALUE self)
0
@@ -82,9 +83,9 @@ VALUE fastxml_doc_transform(VALUE self, VALUE xform)
0
-VALUE fastxml_doc_search(VALUE self, VALUE raw_xpath
)
0
+VALUE fastxml_doc_search(VALUE self, VALUE raw_xpath
, VALUE blk)
0
- return fastxml_xpath_search( self, raw_xpath
);
0
+ return fastxml_xpath_search( self, raw_xpath
, blk );
0
VALUE fastxml_doc_to_s(VALUE self)
0
@@ -121,7 +122,7 @@ VALUE fastxml_doc_root(VALUE self)
0
VALUE fastxml_doc_initialize(VALUE self, VALUE xml_doc_str)
0
+ VALUE data_s, dv
, lines;
0
int parser_opts = XML_PARSE_NOERROR | XML_PARSE_NOWARNING;
0
int parse_dtd = XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID;
0
@@ -132,9 +133,14 @@ VALUE fastxml_doc_initialize(VALUE self, VALUE xml_doc_str)
0
- data_s = rb_obj_as_string( xml_doc_str );
0
- rb_iv_set( self, "@raw_data", data_s );
0
+ if (rb_respond_to( xml_doc_str, s_readlines )) {
0
+ lines = rb_funcall( xml_doc_str, s_readlines, 0 );
0
+ data_s = rb_funcall( lines, s_to_s, 0 );
0
+ data_s = rb_obj_as_string( xml_doc_str );
0
+ rb_iv_set( self, "@raw_data", data_s );
0
data = ALLOC(fxml_data_t);
0
memset( data, (int)NULL, sizeof(fxml_data_t) );
Comments
No one has commented yet.