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

Function xmlSchemaVReaderWalk

ThirdParty/libxml2/vtklibxml2/xmlschemas.c:26902–27091  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26900
26901#ifdef XML_SCHEMA_READER_ENABLED
26902static int
26903xmlSchemaVReaderWalk(xmlSchemaValidCtxtPtr vctxt)
26904{
26905 const int WHTSP = 13, SIGN_WHTSP = 14, END_ELEM = 15;
26906 int depth, nodeType, ret = 0, consumed;
26907 xmlSchemaNodeInfoPtr ielem;
26908
26909 vctxt->depth = -1;
26910 ret = xmlTextReaderRead(vctxt->reader);
26911 /*
26912 * Move to the document element.
26913 */
26914 while (ret == 1) {
26915 nodeType = xmlTextReaderNodeType(vctxt->reader);
26916 if (nodeType == XML_ELEMENT_NODE)
26917 goto root_found;
26918 ret = xmlTextReaderRead(vctxt->reader);
26919 }
26920 goto exit;
26921
26922root_found:
26923
26924 do {
26925 depth = xmlTextReaderDepth(vctxt->reader);
26926 nodeType = xmlTextReaderNodeType(vctxt->reader);
26927
26928 if (nodeType == XML_ELEMENT_NODE) {
26929
26930 vctxt->depth++;
26931 if (xmlSchemaValidatorPushElem(vctxt) == -1) {
26932 VERROR_INT("xmlSchemaVReaderWalk",
26933 "calling xmlSchemaValidatorPushElem()");
26934 goto internal_error;
26935 }
26936 ielem = vctxt->inode;
26937 ielem->localName = xmlTextReaderLocalName(vctxt->reader);
26938 ielem->nsName = xmlTextReaderNamespaceUri(vctxt->reader);
26939 ielem->flags |= XML_SCHEMA_NODE_INFO_FLAG_OWNED_NAMES;
26940 /*
26941 * Is the element empty?
26942 */
26943 ret = xmlTextReaderIsEmptyElement(vctxt->reader);
26944 if (ret == -1) {
26945 VERROR_INT("xmlSchemaVReaderWalk",
26946 "calling xmlTextReaderIsEmptyElement()");
26947 goto internal_error;
26948 }
26949 if (ret) {
26950 ielem->flags |= XML_SCHEMA_ELEM_INFO_EMPTY;
26951 }
26952 /*
26953 * Register attributes.
26954 */
26955 vctxt->nbAttrInfos = 0;
26956 ret = xmlTextReaderMoveToFirstAttribute(vctxt->reader);
26957 if (ret == -1) {
26958 VERROR_INT("xmlSchemaVReaderWalk",
26959 "calling xmlTextReaderMoveToFirstAttribute()");

Callers 1

xmlSchemaVStartFunction · 0.85

Calls 15

xmlTextReaderReadFunction · 0.85
xmlTextReaderNodeTypeFunction · 0.85
xmlTextReaderDepthFunction · 0.85
xmlTextReaderLocalNameFunction · 0.85
xmlTextReaderValueFunction · 0.85

Tested by

no test coverage detected