Node 0 MemTotal:        7863292 kB
Node 0 MemFree:         1691884 kB
Node 0 MemUsed:         6171408 kB
Node 0 SwapCached:       218200 kB
Node 0 Active:          1425740 kB
Node 0 Inactive:        3259956 kB
Node 0 Active(anon):    1045576 kB
Node 0 Inactive(anon):   326940 kB
Node 0 Active(file):     380164 kB
Node 0 Inactive(file):  2933016 kB
Node 0 Unevictable:        4000 kB
Node 0 Mlocked:               0 kB
Node 0 Dirty:              2344 kB
Node 0 Writeback:             0 kB
Node 0 FilePages:       3567860 kB
Node 0 Mapped:           136776 kB
Node 0 AnonPages:       1190100 kB
Node 0 Shmem:             36464 kB
Node 0 KernelStack:        8768 kB
Node 0 PageTables:        15920 kB
Node 0 SecPageTables:         0 kB
Node 0 NFS_Unstable:          0 kB
Node 0 Bounce:                0 kB
Node 0 WritebackTmp:          0 kB
Node 0 KReclaimable:    1185988 kB
Node 0 Slab:            1351468 kB
Node 0 SReclaimable:    1185988 kB
Node 0 SUnreclaim:       165480 kB
Node 0 AnonHugePages:    557056 kB
Node 0 ShmemHugePages:        0 kB
Node 0 ShmemPmdMapped:        0 kB
Node 0 FileHugePages:         0 kB
Node 0 FilePmdMapped:         0 kB
Node 0 Unaccepted:            0 kB
Node 0 HugePages_Total:     0
Node 0 HugePages_Free:      0
Node 0 HugePages_Surp:      0
  9   ˆl–Ü4ý(&”ÔD¨ 	Å ýÁ9q¦”Å£Áƒh¹a–Ü4ý(&”ÔD¨ 	Å ýÁ9q¦”Å£Å      1
  *   ˆl–Ãa¾”Še¶¥@ŠàŸ¸Å£Ãƒm–A_†I|¥�+ÀÇ Ò    /** 
 * section: 	XPath
 * synopsis: 	Load a document, locate subelements with XPath, modify
 *              said elements and save the resulting document.
 * purpose: 	Shows how to make a full round-trip from a load/edit/save
 * usage:	xpath2 <xml-file> <xpath-expr> <new-value>
 * test:	xpath2 test3.xml '//discarded' discarded > xpath2.tmp && diff xpath2.tmp $(srcdir)/xpath2.res
 * author: 	Aleksey Sanin and Daniel Veillard
 * copy: 	see Copyright for the status of this software.
 */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>

#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>

#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_SAX1_ENABLED) && \
    defined(LIBXML_OUTPUT_ENABLED)


static void usage(const char *name);
static int example4(const char *filename, const xmlChar * xpathExpr,
                    const xmlChar * value);
static void update_xpath_nodes(xmlNodeSetPtr nodes, const xmlChar * value);


int 
main(int argc, char **argv) {
    /* Parse command line and process file */
    if (argc != 4) {
	fprintf(stderr, "Error: wrong number of arguments.\n");
	usage(argv[0]);
	return(-1);
    } 
    
    /* Init libxml */     
    xmlInitParser();
    LIBXML_TEST_VERSION

    /* Do the main job */
    if (example4(argv[1], BAD_CAST argv[2], BAD_CAST argv[3])) {
	usage(argv[0]);
	return(-1);
    }

    /* Shutdown libxml */
    xmlCleanupParser();
    
    /*
     * this is to debug memory for regression tests
     */
    xmlMemoryDump();
    return 0;
}

/**
 * usage:
 * @name:		the program name.
 *
 * Prints usage information.
 */
static void 
usage(const char *name) {
    assert(name);
    
    fprintf(stderr, "Usage: %s <xml-file> <xpath-expr> <value>\n", name);
}

/**
 * example4:
 * @filename:		the input XML filename.
 * @xpathExpr:		the xpath expression for evaluation.
 * @value:		the new node content.
 *
 * Parses input XML file, evaluates XPath expression and update the nodes
 * then print the result.
 *
 * Returns 0 on success and a negative value otherwise.
 */
static int 
example4(const char* filename, const xmlChar* xpathExpr, const xmlChar* value) {
    xmlDocPtr doc;
    xmlXPathContextPtr xpathCtx; 
    xmlXPathObjectPtr xpathObj; 
    
    assert(filename);
    assert(xpathExpr);
    assert(value);

    /* Load XML document */
    doc = xmlParseFile(filename);
    if (doc == NULL) {
	fprintf(stderr, "Error: unable to parse file \"%s\"\n", filename);
	return(-1);
    }

    /* Create xpath evaluation context */
    xpathCtx = xmlXPathNewContext(doc);
    if(xpathCtx == NULL) {
        fprintf(stderr,"Error: unable t