* 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. */
| 1366 | * Returns 0 if the node has no relative namespaces or -1 otherwise. |
| 1367 | */ |
| 1368 | static int |
| 1369 | xmlC14NCheckForRelativeNamespaces(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: |
no test coverage detected