/*
 * call-seq:
 * base_uri
 *
 * Get the xml:base of the node
 */
static VALUE base_uri(VALUE self)
{
  xmlTextReaderPtr reader;
  const char * base_uri;

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

  return NOKOGIRI_STR_NEW2(base_uri);
}
Exemple #2
0
/* reader:base_uri() */
static int xmlreader_base_uri(lua_State *L) {
  xmlreader xr = check_xmlreader(L, 1);
  char *uri = (char*)xmlTextReaderBaseUri(xr);
  if (uri) {
    lua_pushstring(L, uri);
    xmlFree(uri);
    return 1;
  } else {
    lua_pushnil(L);
    lua_pushstring(L, "not available");
    return 2;
  }
}