/* * call-seq: * reader.xml_version -> version * * Determine the XML version of the document being read. */ static VALUE rxml_reader_xml_version(VALUE self) { xmlTextReaderPtr xReader = rxml_text_reader_get(self); const xmlChar *result = xmlTextReaderConstXmlVersion(xReader); const xmlChar *xencoding = xmlTextReaderConstEncoding(xReader); return (result == NULL ? Qnil : rxml_new_cstr(result, xencoding)); }
/* * call-seq: * xml_version * * Get the XML version of the document being read */ static VALUE xml_version(VALUE self) { xmlTextReaderPtr reader; Data_Get_Struct(self, xmlTextReader, reader); const char * version = (const char *)xmlTextReaderConstXmlVersion(reader); if(version == NULL) return Qnil; return NOKOGIRI_STR_NEW2(version, "UTF-8"); }
/* reader:xml_version() */ static int xmlreader_xml_version(lua_State *L) { xmlreader xr = check_xmlreader(L, 1); const char *xml_version = (char*)xmlTextReaderConstXmlVersion(xr); if (xml_version) { lua_pushstring(L, xml_version); return 1; } else { lua_pushnil(L); xmlreader_pusherror(L); return 2; } }
/* * call-seq: * reader.xml_version -> version * * Determine the XML version of the document being read. */ static VALUE rxml_reader_xml_version(VALUE self) { const xmlChar *result = xmlTextReaderConstXmlVersion(rxml_text_reader_get(self)); return (result == NULL ? Qnil : rb_str_new2((const char*)result)); }