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

Function xmlNsInScope

ThirdParty/libxml2/vtklibxml2/tree.c:6156–6184  ·  view source on GitHub ↗

* xmlNsInScope: * @doc: the document * @node: the current node * @ancestor: the ancestor carrying the namespace * @prefix: the namespace prefix * * Verify that the given namespace held on @ancestor is still in scope * on node. * * Returns 1 if true, 0 if false and -1 in case of error. */

Source from the content-addressed store, hash-verified

6154 * Returns 1 if true, 0 if false and -1 in case of error.
6155 */
6156static int
6157xmlNsInScope(xmlDocPtr doc ATTRIBUTE_UNUSED, xmlNodePtr node,
6158 xmlNodePtr ancestor, const xmlChar * prefix)
6159{
6160 xmlNsPtr tst;
6161
6162 while ((node != NULL) && (node != ancestor)) {
6163 if ((node->type == XML_ENTITY_REF_NODE) ||
6164 (node->type == XML_ENTITY_DECL))
6165 return (-1);
6166 if (node->type == XML_ELEMENT_NODE) {
6167 tst = node->nsDef;
6168 while (tst != NULL) {
6169 if ((tst->prefix == NULL)
6170 && (prefix == NULL))
6171 return (0);
6172 if ((tst->prefix != NULL)
6173 && (prefix != NULL)
6174 && (xmlStrEqual(tst->prefix, prefix)))
6175 return (0);
6176 tst = tst->next;
6177 }
6178 }
6179 node = node->parent;
6180 }
6181 if (node != ancestor)
6182 return (-1);
6183 return (1);
6184}
6185
6186/**
6187 * xmlSearchNsByHrefSafe:

Callers 2

xmlSearchNsByHrefSafeFunction · 0.85

Calls 1

xmlStrEqualFunction · 0.85

Tested by

no test coverage detected