From ed4473275a9e8384e15f3c6850ca6bab140c0813 Mon Sep 17 00:00:00 2001 From: megazig Date: Wed, 6 May 2009 10:55:08 -0500 Subject: added matts xml --- xml.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/xml.c b/xml.c index 72c0eda..13894eb 100644 --- a/xml.c +++ b/xml.c @@ -4,6 +4,8 @@ #include "types.h" #include "xml.h" +char xmlbuff[4096]; + char * /* O - Buffer */ get_value(mxml_node_t *node, /* I - Node to get */ void *buffer, /* I - Buffer */ @@ -67,6 +69,26 @@ get_value(mxml_node_t *node, /* I - Node to get */ return buffer; } +const char *whitespace_cb(mxml_node_t *node, int where) +{ + /* code by Matt_P */ + const char *name = node->value.element.name; + mxml_node_t * temp = node; + int depth = 0; + while(temp){ + depth++; + temp = temp->parent; + } + if (where == 3 || where == 1){ + sprintf(xmlbuff, ""); + }else if((node->prev && where == 0 || node->parent) && !(where == 2 && strncmp(name, "ua", 2) && strcmp(name, "flip") && strcmp(name, "zoom") && strcmp(name, "coords") && strcmp(name, "entries") && strcmp(name, "xmlyt") && (strcmp(name, "tag") && strcmp(name, "size") && strcmp(name, "material") && strcmp(name, "colors"))) ){ + sprintf(xmlbuff, "\n%*s", (depth-1)*4, ""); + }else{ + sprintf(xmlbuff, ""); + } + return (xmlbuff); +} +/* const char *whitespace_cb(mxml_node_t *node, int where) { const char *name; @@ -177,9 +199,9 @@ const char *whitespace_cb(mxml_node_t *node, int where) if ((where == MXML_WS_BEFORE_OPEN) || (where == MXML_WS_BEFORE_CLOSE)) return ("\n\t\t\t"); } - /* + / / * Return NULL for no added whitespace... - */ + / / return (NULL); } - +*/ -- cgit v1.3.1