libxml c

I've just started using libxml in c++, so far im able to parse a xml string. now i would like to replace <cms:CMSContent id="leftNav" /> with the string "left" and write the new xml out to cout; any ideas?

string.xml

<html xmlns:cms="http://www.test.com">
<body>
<cms:CMSContent id="leftNav" />
<cms:CMSContent id="rightNav" />
</body>
</html>

test.cpp - function streamFile(string s);

static void streamFile(string s) {
    xmlTextReaderPtr reader;
    int ret;
	
    reader = xmlReaderForMemory(s.c_str(),s.size(), NULL,NULL, 0);
    if (reader != NULL) {
        ret = xmlTextReaderRead(reader);
        while (ret == 1) {
            processNode(reader);
            ret = xmlTextReaderRead(reader);
        }
        xmlFreeTextReader(reader);
        if (ret != 0) {
		cout << "Failed to parse";	
        }
    } else {
	cout << "unable to open";

    }
static void
processNode(xmlTextReaderPtr reader) {
    const xmlChar *name, *value;

    name = xmlTextReaderConstName(reader);
    if (name == NULL)
	name = BAD_CAST "--";

    value = xmlTextReaderConstValue(reader);

    printf("%d %d %s %d %d", 
	    xmlTextReaderDepth(reader),
	    xmlTextReaderNodeType(reader),
	    name,
	    xmlTextReaderIsEmptyElement(reader),
	    xmlTextReaderHasValue(reader));
	//xmlTextReaderConstValue(reader));
    if (value == NULL)
	printf("\n");
    else {
        if (xmlStrlen(value) > 40)
            printf(" %.40s...\n", value);
        else
	    printf(" %s\n", value);
    }
}
#include <stdio.h>
#include <regex.h>

main(int argc, char *argv[])
{
    char *str, line[BUFSIZ];
    regex_t re;

    
    str = "<cms:CMSContent id=\"leftNav\" />";
    if (regcomp(&re, str, REG_EXTENDED)) {
        perror(argv[0]);
        exit(1); 
    }
    while (gets(line)) {
        if (regexec(&re, line, (size_t) 0, NULL, 0))
            printf("%s\n", line);
        else
            printf("left\n");
    }
}