Ejemplo n.º 1
0
gchar*
xml_reader_read_outer_xml (XmlReader *reader)
{
  g_return_val_if_fail (XML_IS_READER (reader), FALSE);

  RETURN_STRDUP_AND_XMLFREE (xmlTextReaderReadOuterXml (reader->xml));
}
Ejemplo n.º 2
0
/* reader:read_outer_xml() */
static int xmlreader_read_outer_xml(lua_State *L)
{
  xmlreader xr = check_xmlreader(L, 1);
  char *str = (char*)xmlTextReaderReadOuterXml(xr);
  if (str) {
    lua_pushstring(L, str);
    xmlFree(str);
    return 1;
  } else {
    lua_pushnil(L);
    lua_pushstring(L, ERR_MSG);
    return 2;
  }
}
Ejemplo n.º 3
0
/*
 * call-seq:
 *    reader.read_outer_xml -> data
 *
 * Read the contents of the current node, including child nodes and markup.
 *
 * Return a string containing the XML content, or nil if the current node is
 * neither an element nor attribute, or has no child nodes.
 */
static VALUE rxml_reader_read_outer_xml(VALUE self)
{
  VALUE result = Qnil;
  xmlTextReaderPtr xReader = rxml_text_reader_get(self);

  xmlChar *xml = xmlTextReaderReadOuterXml(xReader);

  if (xml)
  {
    const xmlChar *xencoding = xmlTextReaderConstEncoding(xReader);
    result = rxml_new_cstr((const char*) xml, xencoding);
    xmlFree(xml);
  }

  return result;
}
Ejemplo n.º 4
0
/*
 * call-seq:
 *   outer_xml
 *
 * Read the current node and its contents, including child nodes and markup.
 * Returns a utf-8 encoded string.
 */
static VALUE outer_xml(VALUE self)
{
  xmlTextReaderPtr reader;
  xmlChar *value;
  VALUE str = Qnil;

  Data_Get_Struct(self, xmlTextReader, reader);

  value = xmlTextReaderReadOuterXml(reader);

  if(value) {
    str = NOKOGIRI_STR_NEW2((char*)value);
    xmlFree(value);
  }
  return str;
}
Ejemplo n.º 5
0
/*
 * call-seq:
 *    reader.read_outer_xml -> data
 *
 * Read the contents of the current node, including child nodes and markup.
 *
 * Return a string containing the XML content, or nil if the current node is
 * neither an element nor attribute, or has no child nodes.
 */
static VALUE rxml_reader_read_outer_xml(VALUE self)
{
  const xmlChar *result = xmlTextReaderReadOuterXml(rxml_text_reader_get(self));
  return (result == NULL ? Qnil : rb_str_new2((const char*)result));
}