| 258 | } |
| 259 | |
| 260 | static void |
| 261 | xmlCtxtGenericNodeCheck(xmlDebugCtxtPtr ctxt, xmlNodePtr node) { |
| 262 | xmlDocPtr doc; |
| 263 | xmlDictPtr dict; |
| 264 | |
| 265 | doc = node->doc; |
| 266 | |
| 267 | if (node->parent == NULL) |
| 268 | xmlDebugErr(ctxt, XML_CHECK_NO_PARENT, |
| 269 | "Node has no parent\n"); |
| 270 | if (node->doc == NULL) { |
| 271 | xmlDebugErr(ctxt, XML_CHECK_NO_DOC, |
| 272 | "Node has no doc\n"); |
| 273 | dict = NULL; |
| 274 | } else { |
| 275 | dict = doc->dict; |
| 276 | if ((dict == NULL) && (ctxt->nodict == 0)) { |
| 277 | #if 0 |
| 278 | /* deactivated right now as it raises too many errors */ |
| 279 | if (doc->type == XML_DOCUMENT_NODE) |
| 280 | xmlDebugErr(ctxt, XML_CHECK_NO_DICT, |
| 281 | "Document has no dictionary\n"); |
| 282 | #endif |
| 283 | ctxt->nodict = 1; |
| 284 | } |
| 285 | if (ctxt->doc == NULL) |
| 286 | ctxt->doc = doc; |
| 287 | |
| 288 | if (ctxt->dict == NULL) { |
| 289 | ctxt->dict = dict; |
| 290 | } |
| 291 | } |
| 292 | if ((node->parent != NULL) && (node->doc != node->parent->doc) && |
| 293 | (!xmlStrEqual(node->name, BAD_CAST "pseudoroot"))) |
| 294 | xmlDebugErr(ctxt, XML_CHECK_WRONG_DOC, |
| 295 | "Node doc differs from parent's one\n"); |
| 296 | if (node->prev == NULL) { |
| 297 | if (node->type == XML_ATTRIBUTE_NODE) { |
| 298 | if ((node->parent != NULL) && |
| 299 | (node != (xmlNodePtr) node->parent->properties)) |
| 300 | xmlDebugErr(ctxt, XML_CHECK_NO_PREV, |
| 301 | "Attr has no prev and not first of attr list\n"); |
| 302 | |
| 303 | } else if ((node->parent != NULL) && (node->parent->children != node)) |
| 304 | xmlDebugErr(ctxt, XML_CHECK_NO_PREV, |
| 305 | "Node has no prev and not first of parent list\n"); |
| 306 | } else { |
| 307 | if (node->prev->next != node) |
| 308 | xmlDebugErr(ctxt, XML_CHECK_WRONG_PREV, |
| 309 | "Node prev->next : back link wrong\n"); |
| 310 | } |
| 311 | if (node->next == NULL) { |
| 312 | if ((node->parent != NULL) && (node->type != XML_ATTRIBUTE_NODE) && |
| 313 | (node->parent->last != node) && |
| 314 | (node->parent->type == XML_ELEMENT_NODE)) |
| 315 | xmlDebugErr(ctxt, XML_CHECK_NO_NEXT, |
| 316 | "Node has no next and not last of parent list\n"); |
| 317 | } else { |
no test coverage detected