MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlXPathRegisterNs

Function xmlXPathRegisterNs

ThirdParty/libxml2/vtklibxml2/xpath.c:4207–4242  ·  view source on GitHub ↗

* xmlXPathRegisterNs: * @ctxt: the XPath context * @prefix: the namespace prefix cannot be NULL or empty string * @ns_uri: the namespace name * * Register a new namespace. If @ns_uri is NULL it unregisters * the namespace * * Returns 0 in case of success, -1 in case of error */

Source from the content-addressed store, hash-verified

4205 * Returns 0 in case of success, -1 in case of error
4206 */
4207int
4208xmlXPathRegisterNs(xmlXPathContextPtr ctxt, const xmlChar *prefix,
4209 const xmlChar *ns_uri) {
4210 xmlChar *copy;
4211
4212 if (ctxt == NULL)
4213 return(-1);
4214 if (prefix == NULL)
4215 return(-1);
4216 if (prefix[0] == 0)
4217 return(-1);
4218
4219 if (ctxt->nsHash == NULL)
4220 ctxt->nsHash = xmlHashCreate(10);
4221 if (ctxt->nsHash == NULL) {
4222 xmlXPathErrMemory(ctxt);
4223 return(-1);
4224 }
4225 if (ns_uri == NULL)
4226 return(xmlHashRemoveEntry(ctxt->nsHash, prefix,
4227 xmlHashDefaultDeallocator));
4228
4229 copy = xmlStrdup(ns_uri);
4230 if (copy == NULL) {
4231 xmlXPathErrMemory(ctxt);
4232 return(-1);
4233 }
4234 if (xmlHashUpdateEntry(ctxt->nsHash, prefix, copy,
4235 xmlHashDefaultDeallocator) < 0) {
4236 xmlXPathErrMemory(ctxt);
4237 xmlFree(copy);
4238 return(-1);
4239 }
4240
4241 return(0);
4242}
4243
4244/**
4245 * xmlXPathNsLookup:

Callers 7

xmlSchematronParseFunction · 0.85
xmlXPtrEvalXPtrPartFunction · 0.85
load_xpath_exprFunction · 0.85
initializeLibxml2Function · 0.85

Calls 5

xmlHashCreateFunction · 0.85
xmlXPathErrMemoryFunction · 0.85
xmlHashRemoveEntryFunction · 0.85
xmlStrdupFunction · 0.85
xmlHashUpdateEntryFunction · 0.85

Tested by 1

load_xpath_exprFunction · 0.68