]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
Add the text output label as "label" attribute to all xml elements.
authorAndreas Hofmeister <andi@collax.com>
Sun, 28 Feb 2010 16:45:12 +0000 (17:45 +0100)
committerVincent <bernat@luffy.cx>
Sat, 6 Mar 2010 09:26:46 +0000 (10:26 +0100)
Might be helpful when creating html via xslt etc.

src/xml_writer.c

index e7d2eed6cadbfa61b4f1103252faacb8d694014a..2e9d0ab4fefde76ae0c0b9a5170923d88de687e8 100644 (file)
@@ -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 ) {