Esempio n. 1
0
/*
 * call-seq:
 *    reader.xml_lang -> value
 *
 * Get the xml:lang scope within which the node resides.
 */
static VALUE rxml_reader_xml_lang(VALUE self)
{
  xmlTextReaderPtr xReader = rxml_text_reader_get(self);
  const xmlChar *result = xmlTextReaderConstXmlLang(xReader);
  const xmlChar *xencoding = xmlTextReaderConstEncoding(xReader);

  return (result == NULL ? Qnil : rxml_new_cstr(result, xencoding));
}
Esempio n. 2
0
/*
 * call-seq:
 *   lang
 *
 * Get the xml:lang scope within which the node resides.
 */
static VALUE lang(VALUE self)
{
  xmlTextReaderPtr reader;
  Data_Get_Struct(self, xmlTextReader, reader);
  const char * lang = (const char *)xmlTextReaderConstXmlLang(reader);
  if(lang == NULL) return Qnil;

  VALUE MAYBE_UNUSED(enc) = rb_iv_get(self, "@encoding");
  return NOKOGIRI_STR_NEW2(lang,
      RTEST(enc) ? StringValuePtr(enc) : NULL);
}
Esempio n. 3
0
/*
 * call-seq:
 *   lang
 *
 * Get the xml:lang scope within which the node resides.
 */
static VALUE lang(VALUE self)
{
  xmlTextReaderPtr reader;
  const char *lang;

  Data_Get_Struct(self, xmlTextReader, reader);
  lang = (const char *)xmlTextReaderConstXmlLang(reader);
  if(lang == NULL) return Qnil;

  return NOKOGIRI_STR_NEW2(lang);
}
Esempio n. 4
0
/*
 * call-seq:
 *    reader.xml_lang -> value
 *
 * Get the xml:lang scope within which the node resides.
 */
static VALUE rxml_reader_xml_lang(VALUE self)
{
  const xmlChar *result = xmlTextReaderConstXmlLang(rxml_text_reader_get(self));
  return (result == NULL ? Qnil : rb_str_new2((const char*)result));
}
Esempio n. 5
0
/* @method String XmlReader.constXmlLang() */
METHOD XmlReader_constXmlLang(Ctx *ctx, knh_sfp_t *sfp)
{
    xmlTextReaderPtr reader = (xmlTextReaderPtr) p_cptr(sfp[0]);
    char* ret = (char*) xmlTextReaderConstXmlLang(reader);
    KNH_RETURN(ctx,sfp,new_String(ctx,B(ret),NULL));
}
Esempio n. 6
0
//## @Native String XmlReader.constXmlLang();
static KMETHOD XmlReader_constXmlLang(KonohaContext *kctx, KonohaStack *sfp)
{
	xmlTextReaderPtr reader = getRawXmlReader(sfp[0]);
	char* ret = (reader != NULL) ? (char *) xmlTextReaderConstXmlLang(reader) : NULL;
	KReturn(KLIB new_kString(kctx, GcUnsafe, ret, strlen(ret), 0));
}