Apply XML_PARSE_NOBLANKS option

Apply XML_PARSE_NOBLANKS option to avoid empty nodes at all

Signed-off-by: Qingtao Cao <harry.cao@nextdc.com>
Improve the read_hist_index.c test case

Improve the read_hist_index.c test case to demonstrate how the XML
parser's internal dictionary should be taken cared when the root
node of a parsed document is reparented to a brand new generated
document

Signed-off-by: Qingtao Cao <harry.cao@nextdc.com>
Maintain consistency of XML parser's internal dictionary

Whenever a root node of a parsed document is reparented to a new
temp doc to generate a response, the temp doc should manipulate
the same dictionary built up along with the original parsed document
so as not to release any string referenced there when the temp
doc is destroyed. Otherwise invalid release of strings cached up
in the dictionary ensue:

==10740== Invalid free() / delete / delete[] / realloc()
==10740==    at 0x4A074C4: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10740==    by 0x3C6265769A: xmlFreeProp (tree.c:2082)
==10740==    by 0x3C6265773B: xmlFreePropList (tree.c:2056)
==10740==    by 0x3C6265750D: xmlFreeNodeList (tree.c:3659)
==10740==    by 0x3C62657450: xmlFreeNodeList (tree.c:3654)
==10740==    by 0x3C62657450: xmlFreeNodeList (tree.c:3654)
==10740==    by 0x3C62657255: xmlFreeDoc (tree.c:1242)
==10740==    by 0x40A1B7: obix_server_reply_object (server.c:575)
==10740==    by 0x40A033: obix_server_handlePOST (server.c:494)
==10740==    by 0x408DD6: obix_handle_request (obix_fcgi.c:319)
==10740==    by 0x408E87: payload (obix_fcgi.c:370)
==10740==    by 0x408F64: main (obix_fcgi.c:423)
==10740==  Address 0xbf4d91b is 91 bytes inside a block of size 1,048 alloc'd
==10740==    at 0x4A06409: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==10740==    by 0x3C626FD82B: xmlDictAddString.isra.0 (dict.c:270)
==10740==    by 0x3C626FE441: xmlDictLookup (dict.c:923)
==10740==    by 0x3C6263A38C: xmlDetectSAX2 (parser.c:1041)
==10740==    by 0x3C62650DE7: xmlParseChunk (parser.c:12178)
==10740==    by 0x408B55: obix_fcgi_read (obix_fcgi.c:259)
==10740==    by 0x408DBF: obix_handle_request (obix_fcgi.c:318)
==10740==    by 0x408E87: payload (obix_fcgi.c:370)
==10740==    by 0x408F64: main (obix_fcgi.c:423)

Said that, above issue can be avoided by duplicating the root node
of the parsed document before adding to the temp doc. Since copying
will duplicate the string in the dictionary. Or, no dictionary is
setup in the first place. Either way is not good enough.

The best approach is to mainpuate a dictionary but carefully have
its consistency maintained so as to avoid duplication of the root
node of the parsed document.
Merge pull request #62 from Qingtao-Cao/devel

Devel