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

Function xmlC14NCheckForRelativeNamespaces

ThirdParty/libxml2/vtklibxml2/c14n.c:1368–1403  ·  view source on GitHub ↗

* xmlC14NCheckForRelativeNamespaces: * @ctx: the C14N context * @cur: the current element node * * Checks that current element node has no relative namespaces defined * * Returns 0 if the node has no relative namespaces or -1 otherwise. */

Source from the content-addressed store, hash-verified

1366 * Returns 0 if the node has no relative namespaces or -1 otherwise.
1367 */
1368static int
1369xmlC14NCheckForRelativeNamespaces(xmlC14NCtxPtr ctx, xmlNodePtr cur)
1370{
1371 xmlNsPtr ns;
1372
1373 if ((ctx == NULL) || (cur == NULL) || (cur->type != XML_ELEMENT_NODE)) {
1374 xmlC14NErrParam(ctx);
1375 return (-1);
1376 }
1377
1378 ns = cur->nsDef;
1379 while (ns != NULL) {
1380 if (xmlStrlen(ns->href) > 0) {
1381 xmlURIPtr uri;
1382 int code;
1383
1384 code = xmlParseURISafe((const char *) ns->href, &uri);
1385 if (uri == NULL) {
1386 if (code < 0)
1387 xmlC14NErrMemory(ctx);
1388 else
1389 xmlC14NErr(ctx, cur, XML_ERR_INVALID_URI,
1390 "parsing namespace uri");
1391 return (-1);
1392 }
1393 if (xmlStrlen((const xmlChar *) uri->scheme) == 0) {
1394 xmlC14NErrRelativeNamespace(ctx, uri->scheme);
1395 xmlFreeURI(uri);
1396 return (-1);
1397 }
1398 xmlFreeURI(uri);
1399 }
1400 ns = ns->next;
1401 }
1402 return (0);
1403}
1404
1405/**
1406 * xmlC14NProcessElementNode:

Callers 1

Calls 7

xmlC14NErrParamFunction · 0.85
xmlStrlenFunction · 0.85
xmlParseURISafeFunction · 0.85
xmlC14NErrMemoryFunction · 0.85
xmlC14NErrFunction · 0.85
xmlFreeURIFunction · 0.85

Tested by

no test coverage detected