more developments on the API testing more cleanups rebuilt Daniel

* gentest.py testapi.c: more developments on the API testing
* HTMLparser.c tree.c: more cleanups
* doc/*: rebuilt
Daniel
diff --git a/tree.c b/tree.c
index 1eea268..87b158e 100644
--- a/tree.c
+++ b/tree.c
@@ -2154,6 +2154,7 @@
     if (content != NULL) {
 	cur->content = xmlStrdup(content);
     }
+    cur->doc = doc;
 
     if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
 	xmlRegisterNodeDefaultValue((xmlNodePtr)cur);
@@ -3525,10 +3526,10 @@
  */
 xmlNodePtr
 xmlReplaceNode(xmlNodePtr old, xmlNodePtr cur) {
-    if (old == NULL) {
+    if ((old == NULL) || (old->parent == NULL)) {
 #ifdef DEBUG_TREE
         xmlGenericError(xmlGenericErrorContext,
-		"xmlReplaceNode : old == NULL\n");
+		"xmlReplaceNode : old == NULL or without parent\n");
 #endif
 	return(NULL);
     }