From 3822145901cc3d4b130370edbf653e306d15ebdb Mon Sep 17 00:00:00 2001 From: Andreas Hofmeister Date: Sun, 28 Feb 2010 17:45:12 +0100 Subject: [PATCH] Add the text output label as "label" attribute to all xml elements. Might be helpful when creating html via xslt etc. --- src/xml_writer.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/xml_writer.c b/src/xml_writer.c index e7d2eed6..2e9d0ab4 100644 --- a/src/xml_writer.c +++ b/src/xml_writer.c @@ -34,6 +34,11 @@ void xml_start(struct writer * w , const char * tag, const char * descr ) { if (xmlTextWriterStartElement(p->xw, BAD_CAST tag) < 0) LLOG_WARN("cannot start '%s' element\n", tag); + + if ( descr && (strlen(descr) > 0) ) { + if (xmlTextWriterWriteFormatAttribute(p->xw, BAD_CAST "label", "%s", descr) < 0) + LLOG_WARN("cannot add attribute 'label' to element %s\n", tag); + } } void xml_attr(struct writer * w, const char * tag, const char * descr, const char * value ) { -- 2.39.5