1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-20 06:50:22 +03:00

util: virxml: introduce virXMLFormatElementDirect

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 <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Pavel Hrdina 2025-03-06 15:31:46 +01:00
parent 915b2bfcfe
commit 4cc562651f
3 changed files with 21 additions and 0 deletions

View File

@ -3781,6 +3781,7 @@ virXMLBufferCreate;
virXMLCheckIllegalChars;
virXMLExtractNamespaceXML;
virXMLFormatElement;
virXMLFormatElementDirect;
virXMLFormatElementEmpty;
virXMLFormatElementInternal;
virXMLFormatMetadata;

View File

@ -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

View File

@ -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);