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

Function xmlXPtrEvalFullXPtr

ThirdParty/libxml2/vtklibxml2/xpointer.c:1103–1162  ·  view source on GitHub ↗

* xmlXPtrEvalFullXPtr: * @ctxt: the XPointer Parser context * @name: the preparsed Scheme for the first XPtrPart * * FullXPtr ::= XPtrPart (S? XPtrPart)* * * As the specs says: * ----------- * When multiple XPtrParts are provided, they must be evaluated in * left-to-right order. If evaluation of one part fails, the nexti * is evaluated. The following conditions cause XPointer part fail

Source from the content-addressed store, hash-verified

1101 * expressions or other schemes.
1102 */
1103static void
1104xmlXPtrEvalFullXPtr(xmlXPathParserContextPtr ctxt, xmlChar *name) {
1105 if (name == NULL)
1106 name = xmlXPathParseName(ctxt);
1107 if (name == NULL)
1108 XP_ERROR(XPATH_EXPR_ERROR);
1109 while (name != NULL) {
1110 ctxt->error = XPATH_EXPRESSION_OK;
1111 xmlXPtrEvalXPtrPart(ctxt, name);
1112
1113 /* in case of syntax error, break here */
1114 if ((ctxt->error != XPATH_EXPRESSION_OK) &&
1115 (ctxt->error != XML_XPTR_UNKNOWN_SCHEME))
1116 return;
1117
1118 /*
1119 * If the returned value is a non-empty nodeset
1120 * or location set, return here.
1121 */
1122 if (ctxt->value != NULL) {
1123 xmlXPathObjectPtr obj = ctxt->value;
1124
1125 switch (obj->type) {
1126#ifdef LIBXML_XPTR_LOCS_ENABLED
1127 case XPATH_LOCATIONSET: {
1128 xmlLocationSetPtr loc = ctxt->value->user;
1129 if ((loc != NULL) && (loc->locNr > 0))
1130 return;
1131 break;
1132 }
1133#endif
1134 case XPATH_NODESET: {
1135 xmlNodeSetPtr loc = ctxt->value->nodesetval;
1136 if ((loc != NULL) && (loc->nodeNr > 0))
1137 return;
1138 break;
1139 }
1140 default:
1141 break;
1142 }
1143
1144 /*
1145 * Evaluating to improper values is equivalent to
1146 * a sub-resource error, clean-up the stack
1147 */
1148 do {
1149 obj = valuePop(ctxt);
1150 if (obj != NULL) {
1151 xmlXPathFreeObject(obj);
1152 }
1153 } while (obj != NULL);
1154 }
1155
1156 /*
1157 * Is there another XPointer part.
1158 */
1159 SKIP_BLANKS;
1160 name = xmlXPathParseName(ctxt);

Callers 1

xmlXPtrEvalXPointerFunction · 0.85

Calls 4

xmlXPathParseNameFunction · 0.85
xmlXPtrEvalXPtrPartFunction · 0.85
valuePopFunction · 0.85
xmlXPathFreeObjectFunction · 0.85

Tested by

no test coverage detected