virSysinfoOEMStringsParseXML(xmlNodePtr node,
                             xmlXPathContextPtr ctxt,
                             virSysinfoOEMStringsDefPtr *oem)
{
    VIR_XPATH_NODE_AUTORESTORE(ctxt);
    int ret = -1;
    virSysinfoOEMStringsDefPtr def;
    int nstrings;
    size_t i;
    g_autofree xmlNodePtr *strings = NULL;

    ctxt->node = node;

    nstrings = virXPathNodeSet("./entry", ctxt, &strings);
    if (nstrings < 0)
        return -1;
    if (nstrings == 0)
        return 0;

    if (VIR_ALLOC(def) < 0)
        goto cleanup;

    if (VIR_ALLOC_N(def->values, nstrings) < 0)
        goto cleanup;

    def->nvalues = nstrings;
    for (i = 0; i < nstrings; i++)
        def->values[i] = virXMLNodeContentString(strings[i]);

    *oem = g_steal_pointer(&def);
    ret = 0;
 cleanup:
    virSysinfoOEMStringsDefFree(def);
    return ret;
}
virSysinfoOEMStringsParseXML(xmlNodePtr node,
                             xmlXPathContextPtr ctxt,
                             virSysinfoOEMStringsDefPtr *oem)
{
    VIR_XPATH_NODE_AUTORESTORE(ctxt);
    int ret = -1;
    virSysinfoOEMStringsDefPtr def;
    int nstrings;
    size_t i;
    g_autofree xmlNodePtr *strings = NULL;

    ctxt->node = node;

    nstrings = virXPathNodeSet("./entry", ctxt, &strings);
    if (nstrings < 0)
        return -1;
    if (nstrings == 0)
        return 0;

    if (VIR_ALLOC(def) < 0)
        goto cleanup;

    if (VIR_ALLOC_N(def->values, nstrings) < 0)
        goto cleanup;

    def->nvalues = nstrings;
    for (i = 0; i < nstrings; i++)
        def->values[i] = virXMLNodeContentString(strings[i]);

    *oem = g_steal_pointer(&def);
    ret = 0;
 cleanup:
    virSysinfoOEMStringsDefFree(def);
    return ret;
}