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

Function xmlNodeSetBase

ThirdParty/libxml2/vtklibxml2/tree.c:5319–5362  ·  view source on GitHub ↗

* xmlNodeSetBase: * @cur: the node being changed * @uri: the new base URI * * Set (or reset) the base URI of a node, i.e. the value of the * xml:base attribute. * * Returns 0 on success, -1 on error. */

Source from the content-addressed store, hash-verified

5317 * Returns 0 on success, -1 on error.
5318 */
5319int
5320xmlNodeSetBase(xmlNodePtr cur, const xmlChar* uri) {
5321 xmlNsPtr ns;
5322 xmlChar* fixed;
5323
5324 if (cur == NULL)
5325 return(-1);
5326 switch(cur->type) {
5327 case XML_ELEMENT_NODE:
5328 case XML_ATTRIBUTE_NODE:
5329 break;
5330 case XML_DOCUMENT_NODE:
5331 case XML_HTML_DOCUMENT_NODE: {
5332 xmlDocPtr doc = (xmlDocPtr) cur;
5333
5334 if (doc->URL != NULL)
5335 xmlFree((xmlChar *) doc->URL);
5336 if (uri == NULL) {
5337 doc->URL = NULL;
5338 } else {
5339 doc->URL = xmlPathToURI(uri);
5340 if (doc->URL == NULL)
5341 return(-1);
5342 }
5343 return(0);
5344 }
5345 default:
5346 return(-1);
5347 }
5348
5349 xmlSearchNsByHrefSafe(cur, XML_XML_NAMESPACE, &ns);
5350 if (ns == NULL)
5351 return(-1);
5352 fixed = xmlPathToURI(uri);
5353 if (fixed == NULL)
5354 return(-1);
5355 if (xmlSetNsProp(cur, ns, BAD_CAST "base", fixed) == NULL) {
5356 xmlFree(fixed);
5357 return(-1);
5358 }
5359 xmlFree(fixed);
5360
5361 return(0);
5362}
5363#endif /* LIBXML_TREE_ENABLED */
5364
5365/**

Callers 2

xmlXIncludeBaseFixupFunction · 0.85
xmlShellSetBaseFunction · 0.85

Calls 3

xmlPathToURIFunction · 0.85
xmlSearchNsByHrefSafeFunction · 0.85
xmlSetNsPropFunction · 0.85

Tested by

no test coverage detected