2006-02-16 22:50:52 +00:00
|
|
|
/*
|
2014-03-07 13:38:51 +00:00
|
|
|
* virxml.h: helper APIs for dealing with XML documents
|
2012-12-13 18:13:21 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2005, 2007-2012 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
2006-02-16 22:50:52 +00:00
|
|
|
*/
|
|
|
|
|
2019-06-18 16:13:06 +00:00
|
|
|
#pragma once
|
2006-02-16 22:50:52 +00:00
|
|
|
|
2019-06-18 16:13:06 +00:00
|
|
|
#include "internal.h"
|
2006-02-16 22:50:52 +00:00
|
|
|
|
2019-06-18 16:13:06 +00:00
|
|
|
#include <libxml/parser.h>
|
|
|
|
#include <libxml/tree.h>
|
|
|
|
#include <libxml/xpath.h>
|
|
|
|
#include <libxml/relaxng.h>
|
2006-02-16 22:50:52 +00:00
|
|
|
|
2019-06-18 16:13:06 +00:00
|
|
|
#include "virbuffer.h"
|
2021-04-16 09:41:45 +00:00
|
|
|
#include "virenum.h"
|
2016-06-07 16:55:28 +00:00
|
|
|
|
2019-09-09 06:33:58 +00:00
|
|
|
xmlXPathContextPtr virXMLXPathContextNew(xmlDocPtr xml)
|
2019-10-14 12:25:14 +00:00
|
|
|
G_GNUC_WARN_UNUSED_RESULT;
|
2019-09-09 06:33:58 +00:00
|
|
|
|
2021-04-16 09:41:45 +00:00
|
|
|
|
|
|
|
typedef enum {
|
2021-04-21 06:49:51 +00:00
|
|
|
VIR_XML_PROP_NONE = 0,
|
2021-04-16 09:41:45 +00:00
|
|
|
VIR_XML_PROP_REQUIRED = 1 << 0, /* Attribute may not be absent */
|
2021-04-16 09:41:47 +00:00
|
|
|
VIR_XML_PROP_NONZERO = 1 << 1, /* Attribute may not be zero */
|
2021-04-16 09:41:45 +00:00
|
|
|
} virXMLPropFlags;
|
|
|
|
|
|
|
|
|
2021-04-14 11:32:12 +00:00
|
|
|
int
|
|
|
|
virXPathBoolean(const char *xpath,
|
|
|
|
xmlXPathContextPtr ctxt);
|
|
|
|
char *
|
|
|
|
virXPathString(const char *xpath,
|
|
|
|
xmlXPathContextPtr ctxt);
|
|
|
|
int
|
|
|
|
virXPathNumber(const char *xpath,
|
|
|
|
xmlXPathContextPtr ctxt,
|
|
|
|
double *value);
|
|
|
|
int
|
|
|
|
virXPathInt(const char *xpath,
|
|
|
|
xmlXPathContextPtr ctxt,
|
|
|
|
int *value);
|
|
|
|
int
|
|
|
|
virXPathUInt(const char *xpath,
|
|
|
|
xmlXPathContextPtr ctxt,
|
|
|
|
unsigned int *value);
|
|
|
|
int
|
|
|
|
virXPathLong(const char *xpath,
|
|
|
|
xmlXPathContextPtr ctxt,
|
|
|
|
long *value);
|
|
|
|
int
|
|
|
|
virXPathULong(const char *xpath,
|
|
|
|
xmlXPathContextPtr ctxt,
|
|
|
|
unsigned long *value);
|
|
|
|
int
|
|
|
|
virXPathULongLong(const char *xpath,
|
|
|
|
xmlXPathContextPtr ctxt,
|
|
|
|
unsigned long long *value);
|
|
|
|
int
|
|
|
|
virXPathLongLong(const char *xpath,
|
|
|
|
xmlXPathContextPtr ctxt,
|
|
|
|
long long *value);
|
|
|
|
int
|
|
|
|
virXPathLongHex(const char *xpath,
|
|
|
|
xmlXPathContextPtr ctxt,
|
|
|
|
long *value);
|
|
|
|
int
|
|
|
|
virXPathULongHex(const char *xpath,
|
|
|
|
xmlXPathContextPtr ctxt,
|
|
|
|
unsigned long *value);
|
|
|
|
xmlNodePtr
|
|
|
|
virXPathNode(const char *xpath,
|
|
|
|
xmlXPathContextPtr ctxt);
|
|
|
|
int
|
|
|
|
virXPathNodeSet(const char *xpath,
|
|
|
|
xmlXPathContextPtr ctxt,
|
|
|
|
xmlNodePtr **list);
|
|
|
|
char *
|
|
|
|
virXMLPropString(xmlNodePtr node,
|
|
|
|
const char *name);
|
|
|
|
char *
|
|
|
|
virXMLNodeContentString(xmlNodePtr node);
|
2008-07-11 16:23:36 +00:00
|
|
|
|
2021-04-16 09:41:45 +00:00
|
|
|
int
|
|
|
|
virXMLPropTristateBool(xmlNodePtr node,
|
|
|
|
const char *name,
|
|
|
|
virXMLPropFlags flags,
|
|
|
|
virTristateBool *result)
|
2021-11-19 17:01:23 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4);
|
2021-04-16 09:41:45 +00:00
|
|
|
|
2021-04-16 09:41:46 +00:00
|
|
|
int
|
|
|
|
virXMLPropTristateSwitch(xmlNodePtr node,
|
|
|
|
const char *name,
|
|
|
|
virXMLPropFlags flags,
|
|
|
|
virTristateSwitch *result)
|
2021-11-19 17:01:23 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4);
|
2021-04-16 09:41:46 +00:00
|
|
|
|
2021-04-16 09:41:47 +00:00
|
|
|
int
|
|
|
|
virXMLPropInt(xmlNodePtr node,
|
|
|
|
const char *name,
|
|
|
|
int base,
|
|
|
|
virXMLPropFlags flags,
|
2021-05-06 12:35:22 +00:00
|
|
|
int *result,
|
|
|
|
int defaultResult)
|
2021-11-19 17:01:23 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5);
|
2021-04-16 09:41:47 +00:00
|
|
|
|
2021-04-16 09:41:48 +00:00
|
|
|
int
|
|
|
|
virXMLPropUInt(xmlNodePtr node,
|
|
|
|
const char* name,
|
|
|
|
int base,
|
|
|
|
virXMLPropFlags flags,
|
|
|
|
unsigned int *result)
|
2021-11-19 17:01:23 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5);
|
2021-04-16 09:41:48 +00:00
|
|
|
|
2021-04-21 15:51:27 +00:00
|
|
|
int
|
|
|
|
virXMLPropULongLong(xmlNodePtr node,
|
|
|
|
const char* name,
|
|
|
|
int base,
|
|
|
|
virXMLPropFlags flags,
|
|
|
|
unsigned long long *result)
|
2021-11-19 17:01:23 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5);
|
2021-04-21 15:51:27 +00:00
|
|
|
|
2021-04-16 09:41:49 +00:00
|
|
|
int
|
|
|
|
virXMLPropEnum(xmlNodePtr node,
|
|
|
|
const char* name,
|
|
|
|
int (*strToInt)(const char*),
|
|
|
|
virXMLPropFlags flags,
|
|
|
|
unsigned int *result)
|
2021-11-19 17:01:23 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
|
|
|
|
ATTRIBUTE_NONNULL(5);
|
2021-04-16 09:41:49 +00:00
|
|
|
|
2021-05-06 15:09:45 +00:00
|
|
|
int
|
|
|
|
virXMLPropEnumDefault(xmlNodePtr node,
|
|
|
|
const char* name,
|
|
|
|
int (*strToInt)(const char*),
|
|
|
|
virXMLPropFlags flags,
|
|
|
|
unsigned int *result,
|
|
|
|
unsigned int defaultResult)
|
2021-11-19 17:01:23 +00:00
|
|
|
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
|
|
|
|
ATTRIBUTE_NONNULL(5);
|
2021-05-06 15:09:45 +00:00
|
|
|
|
|
|
|
|
2011-08-18 21:01:36 +00:00
|
|
|
/* Internal function; prefer the macros below. */
|
2021-04-14 11:32:12 +00:00
|
|
|
xmlDocPtr
|
|
|
|
virXMLParseHelper(int domcode,
|
|
|
|
const char *filename,
|
|
|
|
const char *xmlStr,
|
|
|
|
const char *url,
|
2021-04-14 11:12:12 +00:00
|
|
|
const char *rootelement,
|
2021-08-11 12:36:44 +00:00
|
|
|
xmlXPathContextPtr *ctxt,
|
|
|
|
const char *schemafile,
|
|
|
|
bool validate);
|
2021-04-14 11:32:12 +00:00
|
|
|
|
|
|
|
const char *
|
|
|
|
virXMLPickShellSafeComment(const char *str1,
|
|
|
|
const char *str2);
|
2011-08-18 21:01:36 +00:00
|
|
|
/**
|
|
|
|
* virXMLParse:
|
|
|
|
* @filename: file to parse, or NULL for string parsing
|
|
|
|
* @xmlStr: if @filename is NULL, a string to parse
|
|
|
|
* @url: if @filename is NULL, an optional filename to attribute the parse to
|
|
|
|
*
|
|
|
|
* Parse xml from either a file or a string.
|
|
|
|
*
|
|
|
|
* Return the parsed document object, or NULL on failure.
|
|
|
|
*/
|
2021-08-11 12:36:44 +00:00
|
|
|
#define virXMLParse(filename, xmlStr, url, schemafile, validate) \
|
|
|
|
virXMLParseHelper(VIR_FROM_THIS, filename, xmlStr, url, NULL, NULL, schemafile, validate)
|
2010-02-24 20:44:47 +00:00
|
|
|
|
2011-08-18 21:01:36 +00:00
|
|
|
/**
|
|
|
|
* virXMLParseString:
|
|
|
|
* @xmlStr: a string to parse
|
|
|
|
* @url: an optional filename to attribute the parse to
|
|
|
|
*
|
|
|
|
* Parse xml from a string.
|
|
|
|
*
|
|
|
|
* Return the parsed document object, or NULL on failure.
|
|
|
|
*/
|
2019-06-18 16:13:06 +00:00
|
|
|
#define virXMLParseString(xmlStr, url) \
|
2021-08-11 12:36:44 +00:00
|
|
|
virXMLParseHelper(VIR_FROM_THIS, NULL, xmlStr, url, NULL, NULL, NULL, false)
|
2010-02-24 20:44:47 +00:00
|
|
|
|
2011-08-18 21:01:36 +00:00
|
|
|
/**
|
|
|
|
* virXMLParseFile:
|
|
|
|
* @filename: file to parse
|
|
|
|
*
|
|
|
|
* Parse xml from a file.
|
|
|
|
*
|
|
|
|
* Return the parsed document object, or NULL on failure.
|
|
|
|
*/
|
2019-06-18 16:13:06 +00:00
|
|
|
#define virXMLParseFile(filename) \
|
2021-08-11 12:36:44 +00:00
|
|
|
virXMLParseHelper(VIR_FROM_THIS, filename, NULL, NULL, NULL, NULL, NULL, false)
|
2011-08-18 21:01:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* virXMLParseCtxt:
|
|
|
|
* @filename: file to parse, or NULL for string parsing
|
|
|
|
* @xmlStr: if @filename is NULL, a string to parse
|
|
|
|
* @url: if @filename is NULL, an optional filename to attribute the parse to
|
|
|
|
* @pctxt: if non-NULL, populate with a new context object on success,
|
|
|
|
* with (*pctxt)->node pre-set to the root node
|
|
|
|
*
|
|
|
|
* Parse xml from either a file or a string.
|
|
|
|
*
|
|
|
|
* Return the parsed document object, or NULL on failure.
|
|
|
|
*/
|
2019-06-18 16:13:06 +00:00
|
|
|
#define virXMLParseCtxt(filename, xmlStr, url, pctxt) \
|
2021-08-11 12:36:44 +00:00
|
|
|
virXMLParseHelper(VIR_FROM_THIS, filename, xmlStr, url, NULL, pctxt, NULL, false)
|
2011-08-18 21:01:36 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* virXMLParseStringCtxt:
|
|
|
|
* @xmlStr: a string to parse
|
|
|
|
* @url: an optional filename to attribute the parse to
|
|
|
|
* @pctxt: if non-NULL, populate with a new context object on success,
|
|
|
|
* with (*pctxt)->node pre-set to the root node
|
|
|
|
*
|
|
|
|
* Parse xml from a string.
|
|
|
|
*
|
|
|
|
* Return the parsed document object, or NULL on failure.
|
|
|
|
*/
|
2019-06-18 16:13:06 +00:00
|
|
|
#define virXMLParseStringCtxt(xmlStr, url, pctxt) \
|
2021-08-11 12:36:44 +00:00
|
|
|
virXMLParseHelper(VIR_FROM_THIS, NULL, xmlStr, url, NULL, pctxt, NULL, false)
|
2011-08-18 21:01:36 +00:00
|
|
|
|
2021-04-14 12:16:28 +00:00
|
|
|
/* virXMLParseStringCtxtRoot is same as above, except it also validates root node name */
|
|
|
|
#define virXMLParseStringCtxtRoot(xmlStr, url, rootnode, pctxt) \
|
2021-08-11 12:36:44 +00:00
|
|
|
virXMLParseHelper(VIR_FROM_THIS, NULL, xmlStr, url, rootnode, pctxt, NULL, false)
|
2021-04-14 12:16:28 +00:00
|
|
|
|
2011-08-18 21:01:36 +00:00
|
|
|
/**
|
|
|
|
* virXMLParseFileCtxt:
|
|
|
|
* @filename: file to parse
|
|
|
|
* @pctxt: if non-NULL, populate with a new context object on success,
|
|
|
|
* with (*pctxt)->node pre-set to the root node
|
|
|
|
*
|
|
|
|
* Parse xml from a file.
|
|
|
|
*
|
|
|
|
* Return the parsed document object, or NULL on failure.
|
|
|
|
*/
|
2019-06-18 16:13:06 +00:00
|
|
|
#define virXMLParseFileCtxt(filename, pctxt) \
|
2021-08-11 12:36:44 +00:00
|
|
|
virXMLParseHelper(VIR_FROM_THIS, filename, NULL, NULL, NULL, pctxt, NULL, false)
|
2010-02-24 20:44:47 +00:00
|
|
|
|
2021-04-14 11:32:12 +00:00
|
|
|
int
|
|
|
|
virXMLSaveFile(const char *path,
|
|
|
|
const char *warnName,
|
|
|
|
const char *warnCommand,
|
|
|
|
const char *xml);
|
2013-09-04 14:49:40 +00:00
|
|
|
|
2021-04-14 11:32:12 +00:00
|
|
|
char *
|
|
|
|
virXMLNodeToString(xmlDocPtr doc,
|
|
|
|
xmlNodePtr node);
|
2017-08-14 12:31:52 +00:00
|
|
|
|
2021-04-14 11:32:12 +00:00
|
|
|
bool
|
|
|
|
virXMLNodeNameEqual(xmlNodePtr node,
|
|
|
|
const char *name);
|
2013-09-06 15:34:43 +00:00
|
|
|
|
2021-04-14 11:32:12 +00:00
|
|
|
xmlNodePtr
|
|
|
|
virXMLFindChildNodeByNs(xmlNodePtr root,
|
|
|
|
const char *uri);
|
2013-09-06 15:34:43 +00:00
|
|
|
|
2021-04-14 11:32:12 +00:00
|
|
|
int
|
|
|
|
virXMLExtractNamespaceXML(xmlNodePtr root,
|
2013-09-09 09:49:11 +00:00
|
|
|
const char *uri,
|
2021-04-14 11:32:12 +00:00
|
|
|
char **doc);
|
2013-09-09 09:49:11 +00:00
|
|
|
|
2021-04-14 11:32:12 +00:00
|
|
|
int
|
|
|
|
virXMLInjectNamespace(xmlNodePtr node,
|
|
|
|
const char *uri,
|
|
|
|
const char *key);
|
2016-06-24 15:19:35 +00:00
|
|
|
|
2021-04-14 11:32:12 +00:00
|
|
|
void
|
|
|
|
virXMLNodeSanitizeNamespaces(xmlNodePtr node);
|
|
|
|
|
|
|
|
int
|
|
|
|
virXMLCheckIllegalChars(const char *nodeName,
|
|
|
|
const char *str,
|
|
|
|
const char *illegal);
|
2016-10-19 20:57:46 +00:00
|
|
|
|
2016-06-07 16:55:28 +00:00
|
|
|
struct _virXMLValidator {
|
|
|
|
xmlRelaxNGParserCtxtPtr rngParser;
|
|
|
|
xmlRelaxNGPtr rng;
|
|
|
|
xmlRelaxNGValidCtxtPtr rngValid;
|
|
|
|
virBuffer buf;
|
|
|
|
char *schemafile;
|
|
|
|
};
|
|
|
|
typedef struct _virXMLValidator virXMLValidator;
|
|
|
|
|
2021-03-11 07:16:13 +00:00
|
|
|
virXMLValidator *
|
2016-06-07 16:56:23 +00:00
|
|
|
virXMLValidatorInit(const char *schemafile);
|
|
|
|
|
2016-06-07 16:58:02 +00:00
|
|
|
int
|
2021-03-11 07:16:13 +00:00
|
|
|
virXMLValidatorValidate(virXMLValidator *validator,
|
2016-06-07 16:58:02 +00:00
|
|
|
xmlDocPtr doc);
|
|
|
|
|
2014-11-18 14:50:05 +00:00
|
|
|
int
|
|
|
|
virXMLValidateAgainstSchema(const char *schemafile,
|
|
|
|
xmlDocPtr xml);
|
2020-09-30 11:55:02 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
virXMLValidateNodeAgainstSchema(const char *schemafile,
|
|
|
|
xmlNodePtr node);
|
|
|
|
|
2016-06-07 16:57:29 +00:00
|
|
|
void
|
2021-03-11 07:16:13 +00:00
|
|
|
virXMLValidatorFree(virXMLValidator *validator);
|
2020-10-07 08:26:30 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virXMLValidator, virXMLValidatorFree);
|
2014-11-18 14:50:05 +00:00
|
|
|
|
2019-10-24 13:50:50 +00:00
|
|
|
void
|
2021-03-11 07:16:13 +00:00
|
|
|
virXMLFormatElement(virBuffer *buf,
|
2017-08-24 13:08:23 +00:00
|
|
|
const char *name,
|
2021-03-11 07:16:13 +00:00
|
|
|
virBuffer *attrBuf,
|
|
|
|
virBuffer *childBuf);
|
2017-08-24 13:08:23 +00:00
|
|
|
|
2021-04-13 14:12:17 +00:00
|
|
|
void
|
|
|
|
virXMLFormatElementEmpty(virBuffer *buf,
|
|
|
|
const char *name,
|
|
|
|
virBuffer *attrBuf,
|
|
|
|
virBuffer *childBuf);
|
|
|
|
|
2021-05-25 09:21:02 +00:00
|
|
|
int
|
|
|
|
virXMLFormatMetadata(virBuffer *buf,
|
|
|
|
xmlNodePtr metadata);
|
2021-04-13 14:12:17 +00:00
|
|
|
|
2019-02-26 16:34:57 +00:00
|
|
|
struct _virXPathContextNodeSave {
|
|
|
|
xmlXPathContextPtr ctxt;
|
|
|
|
xmlNodePtr node;
|
|
|
|
};
|
|
|
|
typedef struct _virXPathContextNodeSave virXPathContextNodeSave;
|
|
|
|
|
|
|
|
void
|
2021-03-11 07:16:13 +00:00
|
|
|
virXPathContextNodeRestore(virXPathContextNodeSave *save);
|
2019-02-26 16:34:57 +00:00
|
|
|
|
2019-10-15 12:47:50 +00:00
|
|
|
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(virXPathContextNodeSave, virXPathContextNodeRestore);
|
2019-02-26 16:34:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* VIR_XPATH_NODE_AUTORESTORE:
|
|
|
|
* @ctxt: XML XPath context pointer
|
|
|
|
*
|
|
|
|
* This macro ensures that when the scope where it's used ends, @ctxt's current
|
|
|
|
* node pointer is reset to the original value when this macro was used.
|
|
|
|
*/
|
2019-06-18 16:13:06 +00:00
|
|
|
#define VIR_XPATH_NODE_AUTORESTORE(_ctxt) \
|
2020-07-28 19:47:29 +00:00
|
|
|
VIR_WARNINGS_NO_UNUSED_VARIABLE \
|
2019-10-15 12:47:50 +00:00
|
|
|
g_auto(virXPathContextNodeSave) _ctxt ## CtxtSave = { .ctxt = _ctxt,\
|
|
|
|
.node = _ctxt->node}; \
|
2020-07-28 19:47:29 +00:00
|
|
|
VIR_WARNINGS_RESET
|
2019-02-26 16:34:57 +00:00
|
|
|
|
2019-10-15 12:47:50 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(xmlDoc, xmlFreeDoc);
|
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(xmlXPathContext, xmlXPathFreeContext);
|
2021-08-11 11:34:32 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(xmlXPathObject, xmlXPathFreeObject);
|
2020-06-10 03:43:56 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(xmlBuffer, xmlBufferFree);
|
2021-02-24 09:38:04 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(xmlNode, xmlFreeNode);
|
2021-04-14 10:54:41 +00:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(xmlParserCtxt, xmlFreeParserCtxt);
|
2019-08-20 15:45:10 +00:00
|
|
|
|
2021-04-14 11:32:12 +00:00
|
|
|
typedef int (*virXMLNamespaceParse)(xmlXPathContextPtr ctxt,
|
|
|
|
void **nsdata);
|
2019-08-20 15:45:10 +00:00
|
|
|
typedef void (*virXMLNamespaceFree)(void *nsdata);
|
2021-04-14 11:32:12 +00:00
|
|
|
typedef int (*virXMLNamespaceFormat)(virBuffer *buf,
|
|
|
|
void *nsdata);
|
2019-08-20 15:45:10 +00:00
|
|
|
typedef const char *(*virXMLNamespaceHref)(void);
|
|
|
|
|
|
|
|
struct _virXMLNamespace {
|
|
|
|
virXMLNamespaceParse parse;
|
|
|
|
virXMLNamespaceFree free;
|
|
|
|
virXMLNamespaceFormat format;
|
2019-08-20 22:03:15 +00:00
|
|
|
const char *prefix;
|
2019-08-21 07:48:47 +00:00
|
|
|
const char *uri;
|
2019-08-20 15:45:10 +00:00
|
|
|
};
|
|
|
|
typedef struct _virXMLNamespace virXMLNamespace;
|
2019-08-20 20:50:10 +00:00
|
|
|
|
|
|
|
void
|
2021-03-11 07:16:13 +00:00
|
|
|
virXMLNamespaceFormatNS(virBuffer *buf,
|
2019-08-20 20:50:10 +00:00
|
|
|
virXMLNamespace const *ns);
|
2019-08-20 20:14:13 +00:00
|
|
|
int
|
|
|
|
virXMLNamespaceRegister(xmlXPathContextPtr ctxt,
|
|
|
|
virXMLNamespace const *ns);
|
2020-05-28 10:38:43 +00:00
|
|
|
|
2021-04-14 11:32:12 +00:00
|
|
|
int
|
|
|
|
virParseScaledValue(const char *xpath,
|
|
|
|
const char *units_xpath,
|
|
|
|
xmlXPathContextPtr ctxt,
|
|
|
|
unsigned long long *val,
|
|
|
|
unsigned long long scale,
|
|
|
|
unsigned long long max,
|
|
|
|
bool required);
|
2021-02-23 16:57:13 +00:00
|
|
|
|
|
|
|
xmlBufferPtr
|
|
|
|
virXMLBufferCreate(void);
|
2021-02-24 08:35:05 +00:00
|
|
|
|
|
|
|
xmlNodePtr
|
|
|
|
virXMLNewNode(xmlNsPtr ns,
|
|
|
|
const char *name);
|