Method: OvirtSDK4::XmlWriter#write_element

Defined in:
ext/ovirtsdk4c/ov_xml_writer.c

#write_element(name, value) ⇒ Object



235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'ext/ovirtsdk4c/ov_xml_writer.c', line 235

static VALUE ov_xml_writer_write_element(VALUE self, VALUE name, VALUE value) {
    char* c_name;
    char* c_value;
    int rc;
    ov_xml_writer_object* ptr;

    ov_xml_writer_ptr(self, ptr);
    ov_xml_writer_check_closed(ptr);
    Check_Type(name, T_STRING);
    Check_Type(value, T_STRING);
    c_name = StringValueCStr(name);
    c_value = StringValueCStr(value);
    rc = xmlTextWriterWriteElement(ptr->writer, BAD_CAST c_name, BAD_CAST c_value);
    if (rc < 0) {
        rb_raise(ov_error_class, "Can't write element with name \"%s\" and value \"%s\"", c_name, c_value);
    }
    return Qnil;
}