Show
Ignore:
Timestamp:
08/30/08 00:14:25 (4 months ago)
Author:
Mark Guzman <segfault@…>
Parents:
9474da7584bfc0373ae26f41223d824bbcce3baa
Children:
5f7de15c00f6f991e77caf8bd30ac9eda203035a
git-committer:
Mark Guzman <segfault@hasno.info> / 2008-08-30T00:14:25Z-0400
Message:

finally loading properly as a gem

Location:
ext
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • ext/fastxml.c

    r7d973e r2168c4  
    5959         
    6060        /* pull in the ruby side of things */ 
    61         rb_require( "lib/fastxml_lib" );      // ruby-side methods for the FastXml classes 
    62         rb_require( "lib/fastxml_helpers" );  // FastXml and FastHtml methods 
     61        rb_require( "fastxml/fastxml_lib" );      // ruby-side methods for the FastXml classes 
     62        rb_require( "fastxml/fastxml_helpers" );  // FastXml and FastHtml methods 
    6363} 
    6464 
  • ext/fastxml_doc.c

    r7d973e r2168c4  
    217217} 
    218218 
     219/* Returns the FastXml::Node object representing the root element of 
     220 * the target document 
     221 * 
     222 * call-seq: 
     223 *   puts doc.root.name 
     224 */ 
     225VALUE fastxml_doc_root_set(VALUE self, VALUE newroot) 
     226{ 
     227    VALUE dv, odv; 
     228    fxml_data_t *data, *node_data; 
     229    xmlNodePtr root, new_root; 
     230 
     231    dv = rb_iv_get( self, "@lxml_doc" ); 
     232    Data_Get_Struct( dv, fxml_data_t, data ); 
     233 
     234        odv = rb_iv_get( self, "@lxml_doc" ); 
     235        Data_Get_Struct( odv, fxml_data_t, node_data ); 
     236 
     237    root = xmlDocGetRootElement( data->doc ); 
     238         
     239        if (rb_obj_is_kind_of(newroot, rb_cFastXmlNode) == Qfalse && rb_obj_is_kind_of(newroot, rb_cString) == Qfalse) 
     240          rb_raise(rb_eTypeError, "must pass a FastXml::Node or String type object"); 
     241 
     242        new_root = xmlDocSetRootElement( data->doc, node_data->node ); 
     243        if (new_root == NULL) 
     244          return Qnil; 
     245         
     246        return newroot; 
     247} 
     248 
    219249/* Parse an input string/array/stringio object into a FastXml::Doc object. 
    220250 *