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

Function xmlShellRegisterRootNamespaces

ThirdParty/libxml2/vtklibxml2/debugXML.c:2146–2164  ·  view source on GitHub ↗

* xmlShellRegisterRootNamespaces: * @ctxt: the shell context * @arg: unused * @node: the root element * @node2: unused * * Implements the XML shell function "setrootns" * which registers all namespaces declarations found on the root element. * * Returns 0 on success and a negative value otherwise. */

Source from the content-addressed store, hash-verified

2144 * Returns 0 on success and a negative value otherwise.
2145 */
2146static int
2147xmlShellRegisterRootNamespaces(xmlShellCtxtPtr ctxt, char *arg ATTRIBUTE_UNUSED,
2148 xmlNodePtr root, xmlNodePtr node2 ATTRIBUTE_UNUSED)
2149{
2150 xmlNsPtr ns;
2151
2152 if ((root == NULL) || (root->type != XML_ELEMENT_NODE) ||
2153 (root->nsDef == NULL) || (ctxt == NULL) || (ctxt->pctxt == NULL))
2154 return(-1);
2155 ns = root->nsDef;
2156 while (ns != NULL) {
2157 if (ns->prefix == NULL)
2158 xmlXPathRegisterNs(ctxt->pctxt, BAD_CAST "defaultns", ns->href);
2159 else
2160 xmlXPathRegisterNs(ctxt->pctxt, ns->prefix, ns->href);
2161 ns = ns->next;
2162 }
2163 return(0);
2164}
2165#endif
2166
2167/**

Callers 1

xmlShellFunction · 0.85

Calls 1

xmlXPathRegisterNsFunction · 0.85

Tested by

no test coverage detected