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

Function xmlXPtrAdvanceNode

ThirdParty/libxml2/vtklibxml2/xpointer.c:2251–2290  ·  view source on GitHub ↗

* xmlXPtrAdvanceNode: * @cur: the node * @level: incremented/decremented to show level in tree * * Advance to the next element or text node in document order * TODO: add a stack for entering/exiting entities * * Returns -1 in case of failure, 0 otherwise */

Source from the content-addressed store, hash-verified

2249 * Returns -1 in case of failure, 0 otherwise
2250 */
2251xmlNodePtr
2252xmlXPtrAdvanceNode(xmlNodePtr cur, int *level) {
2253next:
2254 if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL))
2255 return(NULL);
2256 if (cur->children != NULL) {
2257 cur = cur->children ;
2258 if (level != NULL)
2259 (*level)++;
2260 goto found;
2261 }
2262skip: /* This label should only be needed if something is wrong! */
2263 if (cur->next != NULL) {
2264 cur = cur->next;
2265 goto found;
2266 }
2267 do {
2268 cur = cur->parent;
2269 if (level != NULL)
2270 (*level)--;
2271 if (cur == NULL) return(NULL);
2272 if (cur->next != NULL) {
2273 cur = cur->next;
2274 goto found;
2275 }
2276 } while (cur != NULL);
2277
2278found:
2279 if ((cur->type != XML_ELEMENT_NODE) &&
2280 (cur->type != XML_TEXT_NODE) &&
2281 (cur->type != XML_DOCUMENT_NODE) &&
2282 (cur->type != XML_HTML_DOCUMENT_NODE) &&
2283 (cur->type != XML_CDATA_SECTION_NODE)) {
2284 if (cur->type == XML_ENTITY_REF_NODE) { /* Shouldn't happen */
2285 goto skip;
2286 }
2287 goto next;
2288 }
2289 return(cur);
2290}
2291
2292/**
2293 * xmlXPtrAdvanceChar:

Callers 5

xmlXPtrAdvanceCharFunction · 0.85
xmlXPtrMatchStringFunction · 0.85
xmlXPtrSearchStringFunction · 0.85
xmlXIncludeCopyRangeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected