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

Function xmlDOMWrapStoreNs

ThirdParty/libxml2/vtklibxml2/tree.c:7962–7994  ·  view source on GitHub ↗

* xmlDOMWrapStoreNs: * @doc: the doc * @nsName: the namespace name * @prefix: the prefix * * Creates or reuses an xmlNs struct on doc->oldNs with * the given prefix and namespace name. * * Returns the acquired ns struct or NULL in case of an API * or internal error. */

Source from the content-addressed store, hash-verified

7960* or internal error.
7961*/
7962static xmlNsPtr
7963xmlDOMWrapStoreNs(xmlDocPtr doc,
7964 const xmlChar *nsName,
7965 const xmlChar *prefix)
7966{
7967 xmlNsPtr ns;
7968
7969 if (doc == NULL)
7970 return (NULL);
7971 ns = xmlTreeEnsureXMLDecl(doc);
7972 if (ns == NULL)
7973 return (NULL);
7974 if (ns->next != NULL) {
7975 /* Reuse. */
7976 ns = ns->next;
7977 while (ns != NULL) {
7978 if (((ns->prefix == prefix) ||
7979 xmlStrEqual(ns->prefix, prefix)) &&
7980 xmlStrEqual(ns->href, nsName)) {
7981 return (ns);
7982 }
7983 if (ns->next == NULL)
7984 break;
7985 ns = ns->next;
7986 }
7987 }
7988 /* Create. */
7989 if (ns != NULL) {
7990 ns->next = xmlNewNs(NULL, nsName, prefix);
7991 return (ns->next);
7992 }
7993 return(NULL);
7994}
7995
7996/*
7997* xmlDOMWrapNewCtxt:

Callers 3

xmlDOMWrapRemoveNodeFunction · 0.85
xmlDOMWrapAdoptAttrFunction · 0.85

Calls 3

xmlTreeEnsureXMLDeclFunction · 0.85
xmlStrEqualFunction · 0.85
xmlNewNsFunction · 0.85

Tested by

no test coverage detected