summaryrefslogtreecommitdiff
path: root/debugXML.c
diff options
context:
space:
mode:
Diffstat (limited to 'debugXML.c')
-rw-r--r--debugXML.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/debugXML.c b/debugXML.c
index 3cb2848..59529d6 100644
--- a/debugXML.c
+++ b/debugXML.c
@@ -34,6 +34,8 @@
#include <libxml/relaxng.h>
#endif
+#define DUMP_TEXT_TYPE 1
+
typedef struct _xmlDebugCtxt xmlDebugCtxt;
typedef xmlDebugCtxt *xmlDebugCtxtPtr;
struct _xmlDebugCtxt {
@@ -46,6 +48,7 @@ struct _xmlDebugCtxt {
int check; /* do just checkings */
int errors; /* number of errors found */
int nodict; /* if the document has no dictionnary */
+ int options; /* options */
};
static void xmlCtxtDumpNodeList(xmlDebugCtxtPtr ctxt, xmlNodePtr node);
@@ -63,6 +66,7 @@ xmlCtxtDumpInitCtxt(xmlDebugCtxtPtr ctxt)
ctxt->node = NULL;
ctxt->dict = NULL;
ctxt->nodict = 0;
+ ctxt->options = 0;
for (i = 0; i < 100; i++)
ctxt->shift[i] = ' ';
ctxt->shift[100] = 0;
@@ -902,9 +906,18 @@ xmlCtxtDumpOneNode(xmlDebugCtxtPtr ctxt, xmlNodePtr node)
if (!ctxt->check) {
xmlCtxtDumpSpaces(ctxt);
if (node->name == (const xmlChar *) xmlStringTextNoenc)
- fprintf(ctxt->output, "TEXT no enc\n");
+ fprintf(ctxt->output, "TEXT no enc");
else
- fprintf(ctxt->output, "TEXT\n");
+ fprintf(ctxt->output, "TEXT");
+ if (ctxt->options & DUMP_TEXT_TYPE) {
+ if (node->content == (xmlChar *) &(node->properties))
+ fprintf(ctxt->output, " compact\n");
+ else if (xmlDictOwns(ctxt->dict, node->content) == 1)
+ fprintf(ctxt->output, " interned\n");
+ else
+ fprintf(ctxt->output, "\n");
+ } else
+ fprintf(ctxt->output, "\n");
}
break;
case XML_CDATA_SECTION_NODE:
@@ -1005,9 +1018,9 @@ xmlCtxtDumpOneNode(xmlDebugCtxtPtr ctxt, xmlNodePtr node)
fprintf(ctxt->output, "PBM: doc == NULL !!!\n");
}
ctxt->depth++;
- if (node->nsDef != NULL)
+ if ((node->type == XML_ELEMENT_NODE) && (node->nsDef != NULL))
xmlCtxtDumpNamespaceList(ctxt, node->nsDef);
- if (node->properties != NULL)
+ if ((node->type == XML_ELEMENT_NODE) && (node->properties != NULL))
xmlCtxtDumpAttrList(ctxt, node->properties);
if (node->type != XML_ENTITY_REF_NODE) {
if ((node->type != XML_ELEMENT_NODE) && (node->content != NULL)) {
@@ -1489,6 +1502,7 @@ xmlDebugDumpDocumentHead(FILE * output, xmlDocPtr doc)
if (output == NULL)
output = stdout;
xmlCtxtDumpInitCtxt(&ctxt);
+ ctxt.options |= DUMP_TEXT_TYPE;
ctxt.output = output;
xmlCtxtDumpDocumentHead(&ctxt, doc);
xmlCtxtDumpCleanCtxt(&ctxt);
@@ -1509,6 +1523,7 @@ xmlDebugDumpDocument(FILE * output, xmlDocPtr doc)
if (output == NULL)
output = stdout;
xmlCtxtDumpInitCtxt(&ctxt);
+ ctxt.options |= DUMP_TEXT_TYPE;
ctxt.output = output;
xmlCtxtDumpDocument(&ctxt, doc);
xmlCtxtDumpCleanCtxt(&ctxt);
@@ -1529,6 +1544,7 @@ xmlDebugDumpDTD(FILE * output, xmlDtdPtr dtd)
if (output == NULL)
output = stdout;
xmlCtxtDumpInitCtxt(&ctxt);
+ ctxt.options |= DUMP_TEXT_TYPE;
ctxt.output = output;
xmlCtxtDumpDTD(&ctxt, dtd);
xmlCtxtDumpCleanCtxt(&ctxt);