| OLD | NEW |
| 1 /* | 1 /* |
| 2 * debugXML.c : This is a set of routines used for debugging the tree | 2 * debugXML.c : This is a set of routines used for debugging the tree |
| 3 * produced by the XML parser. | 3 * produced by the XML parser. |
| 4 * | 4 * |
| 5 * See Copyright for the status of this software. | 5 * See Copyright for the status of this software. |
| 6 * | 6 * |
| 7 * Daniel Veillard <daniel@veillard.com> | 7 * Daniel Veillard <daniel@veillard.com> |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 #define IN_LIBXML | 10 #define IN_LIBXML |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #define DUMP_TEXT_TYPE 1 | 37 #define DUMP_TEXT_TYPE 1 |
| 38 | 38 |
| 39 typedef struct _xmlDebugCtxt xmlDebugCtxt; | 39 typedef struct _xmlDebugCtxt xmlDebugCtxt; |
| 40 typedef xmlDebugCtxt *xmlDebugCtxtPtr; | 40 typedef xmlDebugCtxt *xmlDebugCtxtPtr; |
| 41 struct _xmlDebugCtxt { | 41 struct _xmlDebugCtxt { |
| 42 FILE *output; /* the output file */ | 42 FILE *output; /* the output file */ |
| 43 char shift[101]; /* used for indenting */ | 43 char shift[101]; /* used for indenting */ |
| 44 int depth; /* current depth */ | 44 int depth; /* current depth */ |
| 45 xmlDocPtr doc; /* current document */ | 45 xmlDocPtr doc; /* current document */ |
| 46 xmlNodePtr node; /* current node */ | 46 xmlNodePtr node; /* current node */ |
| 47 xmlDictPtr dict;» » /* the doc dictionnary */ | 47 xmlDictPtr dict;» » /* the doc dictionary */ |
| 48 int check; /* do just checkings */ | 48 int check; /* do just checkings */ |
| 49 int errors; /* number of errors found */ | 49 int errors; /* number of errors found */ |
| 50 int nodict;»» » /* if the document has no dictionnary */ | 50 int nodict;»» » /* if the document has no dictionary */ |
| 51 int options; /* options */ | 51 int options; /* options */ |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 static void xmlCtxtDumpNodeList(xmlDebugCtxtPtr ctxt, xmlNodePtr node); | 54 static void xmlCtxtDumpNodeList(xmlDebugCtxtPtr ctxt, xmlNodePtr node); |
| 55 | 55 |
| 56 static void | 56 static void |
| 57 xmlCtxtDumpInitCtxt(xmlDebugCtxtPtr ctxt) | 57 xmlCtxtDumpInitCtxt(xmlDebugCtxtPtr ctxt) |
| 58 { | 58 { |
| 59 int i; | 59 int i; |
| 60 | 60 |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 "String is not UTF-8 %s", (const char *) str); | 236 "String is not UTF-8 %s", (const char *) str); |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 } | 239 } |
| 240 | 240 |
| 241 /** | 241 /** |
| 242 * xmlCtxtCheckName: | 242 * xmlCtxtCheckName: |
| 243 * @ctxt: the debug context | 243 * @ctxt: the debug context |
| 244 * @name: the name | 244 * @name: the name |
| 245 * | 245 * |
| 246 * Do debugging on the name, for example the dictionnary status and | 246 * Do debugging on the name, for example the dictionary status and |
| 247 * conformance to the Name production. | 247 * conformance to the Name production. |
| 248 */ | 248 */ |
| 249 static void | 249 static void |
| 250 xmlCtxtCheckName(xmlDebugCtxtPtr ctxt, const xmlChar * name) | 250 xmlCtxtCheckName(xmlDebugCtxtPtr ctxt, const xmlChar * name) |
| 251 { | 251 { |
| 252 if (ctxt->check) { | 252 if (ctxt->check) { |
| 253 if (name == NULL) { | 253 if (name == NULL) { |
| 254 xmlDebugErr(ctxt, XML_CHECK_NO_NAME, "Name is NULL"); | 254 xmlDebugErr(ctxt, XML_CHECK_NO_NAME, "Name is NULL"); |
| 255 return; | 255 return; |
| 256 } | 256 } |
| 257 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) | 257 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) |
| 258 if (xmlValidateName(name, 0)) { | 258 if (xmlValidateName(name, 0)) { |
| 259 xmlDebugErr3(ctxt, XML_CHECK_NOT_NCNAME, | 259 xmlDebugErr3(ctxt, XML_CHECK_NOT_NCNAME, |
| 260 "Name is not an NCName '%s'", (const char *) name); | 260 "Name is not an NCName '%s'", (const char *) name); |
| 261 } | 261 } |
| 262 #endif | 262 #endif |
| 263 if ((ctxt->dict != NULL) && | 263 if ((ctxt->dict != NULL) && |
| 264 (!xmlDictOwns(ctxt->dict, name)) && | 264 (!xmlDictOwns(ctxt->dict, name)) && |
| 265 ((ctxt->doc == NULL) || | 265 ((ctxt->doc == NULL) || |
| 266 ((ctxt->doc->parseFlags & (XML_PARSE_SAX1 | XML_PARSE_NODICT)) == 0
))) { | 266 ((ctxt->doc->parseFlags & (XML_PARSE_SAX1 | XML_PARSE_NODICT)) == 0
))) { |
| 267 xmlDebugErr3(ctxt, XML_CHECK_OUTSIDE_DICT, | 267 xmlDebugErr3(ctxt, XML_CHECK_OUTSIDE_DICT, |
| 268 » » » "Name is not from the document dictionnary '%s'", | 268 » » » "Name is not from the document dictionary '%s'", |
| 269 (const char *) name); | 269 (const char *) name); |
| 270 } | 270 } |
| 271 } | 271 } |
| 272 } | 272 } |
| 273 | 273 |
| 274 static void | 274 static void |
| 275 xmlCtxtGenericNodeCheck(xmlDebugCtxtPtr ctxt, xmlNodePtr node) { | 275 xmlCtxtGenericNodeCheck(xmlDebugCtxtPtr ctxt, xmlNodePtr node) { |
| 276 xmlDocPtr doc; | 276 xmlDocPtr doc; |
| 277 xmlDictPtr dict; | 277 xmlDictPtr dict; |
| 278 | 278 |
| 279 doc = node->doc; | 279 doc = node->doc; |
| 280 | 280 |
| 281 if (node->parent == NULL) | 281 if (node->parent == NULL) |
| 282 xmlDebugErr(ctxt, XML_CHECK_NO_PARENT, | 282 xmlDebugErr(ctxt, XML_CHECK_NO_PARENT, |
| 283 "Node has no parent\n"); | 283 "Node has no parent\n"); |
| 284 if (node->doc == NULL) { | 284 if (node->doc == NULL) { |
| 285 xmlDebugErr(ctxt, XML_CHECK_NO_DOC, | 285 xmlDebugErr(ctxt, XML_CHECK_NO_DOC, |
| 286 "Node has no doc\n"); | 286 "Node has no doc\n"); |
| 287 dict = NULL; | 287 dict = NULL; |
| 288 } else { | 288 } else { |
| 289 dict = doc->dict; | 289 dict = doc->dict; |
| 290 if ((dict == NULL) && (ctxt->nodict == 0)) { | 290 if ((dict == NULL) && (ctxt->nodict == 0)) { |
| 291 #if 0 | 291 #if 0 |
| 292 /* desactivated right now as it raises too many errors */ | 292 /* desactivated right now as it raises too many errors */ |
| 293 if (doc->type == XML_DOCUMENT_NODE) | 293 if (doc->type == XML_DOCUMENT_NODE) |
| 294 xmlDebugErr(ctxt, XML_CHECK_NO_DICT, | 294 xmlDebugErr(ctxt, XML_CHECK_NO_DICT, |
| 295 » » » "Document has no dictionnary\n"); | 295 » » » "Document has no dictionary\n"); |
| 296 #endif | 296 #endif |
| 297 ctxt->nodict = 1; | 297 ctxt->nodict = 1; |
| 298 } | 298 } |
| 299 if (ctxt->doc == NULL) | 299 if (ctxt->doc == NULL) |
| 300 ctxt->doc = doc; | 300 ctxt->doc = doc; |
| 301 | 301 |
| 302 if (ctxt->dict == NULL) { | 302 if (ctxt->dict == NULL) { |
| 303 ctxt->dict = dict; | 303 ctxt->dict = dict; |
| 304 } | 304 } |
| 305 } | 305 } |
| (...skipping 3113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3419 xmlFree(ctxt->filename); | 3419 xmlFree(ctxt->filename); |
| 3420 xmlFree(ctxt); | 3420 xmlFree(ctxt); |
| 3421 if (cmdline != NULL) | 3421 if (cmdline != NULL) |
| 3422 free(cmdline); /* not xmlFree here ! */ | 3422 free(cmdline); /* not xmlFree here ! */ |
| 3423 } | 3423 } |
| 3424 | 3424 |
| 3425 #endif /* LIBXML_XPATH_ENABLED */ | 3425 #endif /* LIBXML_XPATH_ENABLED */ |
| 3426 #define bottom_debugXML | 3426 #define bottom_debugXML |
| 3427 #include "elfgcchack.h" | 3427 #include "elfgcchack.h" |
| 3428 #endif /* LIBXML_DEBUG_ENABLED */ | 3428 #endif /* LIBXML_DEBUG_ENABLED */ |
| OLD | NEW |