[xml] xmlTextReaderReadOuterXml and xmlTextReaderReadInnerXml



What would it take to get the following code pushed to the head?  I'd do it
myself, but I'm not sure if you have some process you want to follow:

xmlChar *
xmlTextReaderReadInnerXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED) {
    xmlChar *                           resbuf;
    xmlNodePtr                          node;
    xmlBufferPtr                        buff;
    xmlDocPtr                           doc;

    node = reader->node;
    xmlTextReaderExpand(reader);
    doc = xmlNewDoc(NULL);
    node = xmlDocCopyNode(node, doc, 1);
    buff = xmlBufferCreate();
    xmlNodeDump(buff, doc, node, 0, 0);

    resbuf = xmlMalloc(buff->size + 1);
    memcpy(resbuf, buff->content, buff->size);
    resbuf[buff->size] = '\0';

    xmlFreeNode(node);
    xmlFreeDoc(doc);
    xmlBufferFree(buff);

    return resbuf;
}

xmlChar *
xmlTextReaderReadOuterXml(xmlTextReaderPtr reader ATTRIBUTE_UNUSED) {
    xmlChar *                           resbuf;
    xmlNodePtr                          node;
    xmlBufferPtr                        buff;
    xmlDocPtr                           doc;

    node = reader->node;
    xmlTextReaderExpand(reader);
    doc = xmlNewDoc(NULL);
    node = xmlDocCopyNode(node, doc, 1);
    buff = xmlBufferCreate();
    xmlNodeDump(buff, doc, node, 0, 0);

    resbuf = xmlMalloc(buff->size + 1);
    memcpy(resbuf, buff->content, buff->size);
    resbuf[buff->size] = '\0';

    xmlFreeNode(node);
    xmlFreeDoc(doc);
    xmlBufferFree(buff);
    return resbuf;
}

Thanks,

James Wert Jr.
JWert ILSTechnology com






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]