Ejemplo n.º 1
0
/*
 * call-seq:
 *    reader.prefix -> prefix
 *
 * Get a shorthand reference to the namespace associated with the node.
 */
static VALUE rxml_reader_prefix(VALUE self)
{
  xmlTextReaderPtr xReader = rxml_text_reader_get(self);
  const xmlChar *result = xmlTextReaderConstPrefix(xReader);
  const xmlChar *xencoding = xmlTextReaderConstEncoding(xReader);

  return (result == NULL ? Qnil : rxml_new_cstr(result, xencoding));
}
Ejemplo n.º 2
0
/*
 * call-seq:
 *   prefix
 *
 * Get the shorthand reference to the namespace associated with the node.
 */
static VALUE prefix(VALUE self)
{
  xmlTextReaderPtr reader;
  Data_Get_Struct(self, xmlTextReader, reader);
  const char * prefix = (const char *)xmlTextReaderConstPrefix(reader);
  if(prefix == NULL) return Qnil;

  VALUE MAYBE_UNUSED(enc) = rb_iv_get(self, "@encoding");
  return NOKOGIRI_STR_NEW2(prefix,
      RTEST(enc) ? StringValuePtr(enc) : NULL);
}
Ejemplo n.º 3
0
/*
 * call-seq:
 *   prefix
 *
 * Get the shorthand reference to the namespace associated with the node.
 */
static VALUE prefix(VALUE self)
{
  xmlTextReaderPtr reader;
  const char *prefix;

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

  return NOKOGIRI_STR_NEW2(prefix);
}
Ejemplo n.º 4
0
/*
 * call-seq:
 *    reader.prefix -> prefix
 *
 * Get a shorthand reference to the namespace associated with the node.
 */
static VALUE rxml_reader_prefix(VALUE self)
{
  const xmlChar *result = xmlTextReaderConstPrefix(rxml_text_reader_get(self));
  return (result == NULL ? Qnil : rb_str_new2((const char*)result));
}
Ejemplo n.º 5
0
/* @method String XmlReader.constPrefix() */
METHOD XmlReader_constPrefix(Ctx *ctx, knh_sfp_t *sfp)
{
    xmlTextReaderPtr reader = (xmlTextReaderPtr) p_cptr(sfp[0]);
    char* ret = (char*) xmlTextReaderConstPrefix(reader);
    KNH_RETURN(ctx,sfp,new_String(ctx,B(ret),NULL));
}
Ejemplo n.º 6
0
//## @Native String XmlReader.constPrefix();
static KMETHOD XmlReader_constPrefix(KonohaContext *kctx, KonohaStack *sfp)
{
	xmlTextReaderPtr reader = getRawXmlReader(sfp[0]);
	char* ret = (reader != NULL) ? (char *) xmlTextReaderConstPrefix(reader) : NULL;
	KReturn(KLIB new_kString(kctx, GcUnsafe, ret, strlen(ret), 0));
}