[xml] Edit a document created with the TextWriter interface

Hello, I'm a newcomer!

I always used with satisfaction the TextWriter interface to create xml
documents. Now I got the need to perform simple edits of the document
after I actually produced it with the TextWriter. Actually, it's just
an "AUTH" element to be filled later with a security hash calculated
in the final document with "AUTH" element empty (the appropriateness
of this is debatable but can't change it: not mine project ;) ). The
question is: can I get a pointer (for example: know the xmlNodePtr) of
an element while creating it with TextWriter so I can modify it later?
If this is not possible/supported, what are the simpler alternatives?
Xpath on the created document or use of another interface?

It follows some sample code to just show the use-case.



    xmlDocPtr doc;
    xmlTextWriterPtr writer = xmlNewTextWriterDoc(&doc, 0);

    xmlTextWriterStartDocument(writer, NULL, "UTF-8", NULL);

    xmlTextWriterStartElement(writer, BAD_CAST "AUTH");
    // Get a "pointer" to the AUTH element


    xmlChar *buffer;
    int size;
    xmlDocDumpMemory(doc, &buffer, &size);

    // Calculate the security hash from the buffer

    // Fill the "AUTH" element with the hash
    // ...

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