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

Function xmlSchemaXPathProcessHistory

ThirdParty/libxml2/vtklibxml2/xmlschemas.c:22594–23088  ·  view source on GitHub ↗

* xmlSchemaXPathProcessHistory: * @vctxt: the WXS validation context * @type: the simple/complex type of the current node if any at all * @val: the precompiled value * * Processes and pops the history items of the IDC state objects. * IDC key-sequences are validated/created on IDC bindings. * * Returns 0 on success and -1 on internal errors. */

Source from the content-addressed store, hash-verified

22592 * Returns 0 on success and -1 on internal errors.
22593 */
22594static int
22595xmlSchemaXPathProcessHistory(xmlSchemaValidCtxtPtr vctxt,
22596 int depth)
22597{
22598 xmlSchemaIDCStateObjPtr sto, nextsto;
22599 int res, matchDepth;
22600 xmlSchemaPSVIIDCKeyPtr key = NULL;
22601 xmlSchemaTypePtr type = vctxt->inode->typeDef, simpleType = NULL;
22602
22603 if (vctxt->xpathStates == NULL)
22604 return (0);
22605 sto = vctxt->xpathStates;
22606
22607 /*
22608 * Evaluate the state objects.
22609 */
22610 while (sto != NULL) {
22611 res = xmlStreamPop((xmlStreamCtxtPtr) sto->xpathCtxt);
22612 if (res == -1) {
22613 VERROR_INT("xmlSchemaXPathProcessHistory",
22614 "calling xmlStreamPop()");
22615 return (-1);
22616 }
22617 if (sto->nbHistory == 0)
22618 goto deregister_check;
22619
22620 matchDepth = sto->history[sto->nbHistory -1];
22621
22622 /*
22623 * Only matches at the current depth are of interest.
22624 */
22625 if (matchDepth != depth) {
22626 sto = sto->next;
22627 continue;
22628 }
22629 if (sto->type == XPATH_STATE_OBJ_TYPE_IDC_FIELD) {
22630 /*
22631 * NOTE: According to
22632 * http://www.w3.org/Bugs/Public/show_bug.cgi?id=2198
22633 * ... the simple-content of complex types is also allowed.
22634 */
22635
22636 if (WXS_IS_COMPLEX(type)) {
22637 if (WXS_HAS_SIMPLE_CONTENT(type)) {
22638 /*
22639 * Sanity check for complex types with simple content.
22640 */
22641 simpleType = type->contentTypeDef;
22642 if (simpleType == NULL) {
22643 VERROR_INT("xmlSchemaXPathProcessHistory",
22644 "field resolves to a CT with simple content "
22645 "but the CT is missing the ST definition");
22646 return (-1);
22647 }
22648 } else
22649 simpleType = NULL;
22650 } else
22651 simpleType = type;

Callers 2

Calls 15

xmlStreamPopFunction · 0.85
FREE_AND_NULLFunction · 0.85
xmlSchemaVErrMemoryFunction · 0.85
xmlSchemaIDCStoreKeyFunction · 0.85
xmlSchemaIDCFreeKeyFunction · 0.85
xmlSchemaHashKeySequenceFunction · 0.85
xmlHashLookupFunction · 0.85
xmlSchemaAreValuesEqualFunction · 0.85

Tested by

no test coverage detected