This can be used to format XML where the element has direct value instead of any subelement. For example:
<maxMemory slots='16' unit='KiB'>1524288</maxMemory> Signed-off-by: Pavel Hrdina <phrd...@redhat.com> --- src/libvirt_private.syms | 1 + src/util/virxml.c | 14 ++++++++++++++ src/util/virxml.h | 6 ++++++ 3 files changed, 21 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 30a9f806f0..e9ddef6453 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3779,6 +3779,7 @@ virXMLBufferCreate; virXMLCheckIllegalChars; virXMLExtractNamespaceXML; virXMLFormatElement; +virXMLFormatElementDirect; virXMLFormatElementEmpty; virXMLFormatElementInternal; virXMLFormatMetadata; diff --git a/src/util/virxml.c b/src/util/virxml.c index 670cace4ab..1295945472 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -1767,6 +1767,20 @@ virXMLFormatElementEmpty(virBuffer *buf, } +/** + * Same as virXMLFormatElement but the child is direct value without + * subelements. + */ +void +virXMLFormatElementDirect(virBuffer *buf, + const char *name, + virBuffer *attrBuf, + virBuffer *childBuf) +{ + virXMLFormatElementInternal(buf, name, attrBuf, childBuf, false, false); +} + + /** * virXMLFormatElement * @buf: the parent buffer where the element will be placed diff --git a/src/util/virxml.h b/src/util/virxml.h index 06ba324df0..4284a8ffce 100644 --- a/src/util/virxml.h +++ b/src/util/virxml.h @@ -351,6 +351,12 @@ virXMLFormatElementEmpty(virBuffer *buf, virBuffer *attrBuf, virBuffer *childBuf); +void +virXMLFormatElementDirect(virBuffer *buf, + const char *name, + virBuffer *attrBuf, + virBuffer *childBuf); + int virXMLFormatMetadata(virBuffer *buf, xmlNodePtr metadata); -- 2.48.1