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

Function xmlSchemaCheckReference

ThirdParty/libxml2/vtklibxml2/xmlschemas.c:6379–6425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6377}
6378
6379static int
6380xmlSchemaCheckReference(xmlSchemaParserCtxtPtr pctxt,
6381 xmlSchemaPtr schema ATTRIBUTE_UNUSED,
6382 xmlNodePtr node,
6383 xmlAttrPtr attr,
6384 const xmlChar *namespaceName)
6385{
6386 /* TODO: Pointer comparison instead? */
6387 if (xmlStrEqual(pctxt->targetNamespace, namespaceName))
6388 return (0);
6389 if (xmlStrEqual(xmlSchemaNs, namespaceName))
6390 return (0);
6391 /*
6392 * Check if the referenced namespace was <import>ed.
6393 */
6394 if (WXS_BUCKET(pctxt)->relations != NULL) {
6395 xmlSchemaSchemaRelationPtr rel;
6396
6397 rel = WXS_BUCKET(pctxt)->relations;
6398 do {
6399 if (WXS_IS_BUCKET_IMPMAIN(rel->type) &&
6400 xmlStrEqual(namespaceName, rel->importNamespace))
6401 return (0);
6402 rel = rel->next;
6403 } while (rel != NULL);
6404 }
6405 /*
6406 * No matching <import>ed namespace found.
6407 */
6408 {
6409 xmlNodePtr n = (attr != NULL) ? (xmlNodePtr) attr : node;
6410
6411 if (namespaceName == NULL)
6412 xmlSchemaCustomErr(ACTXT_CAST pctxt,
6413 XML_SCHEMAP_SRC_RESOLVE, n, NULL,
6414 "References from this schema to components in no "
6415 "namespace are not allowed, since not indicated by an "
6416 "import statement", NULL, NULL);
6417 else
6418 xmlSchemaCustomErr(ACTXT_CAST pctxt,
6419 XML_SCHEMAP_SRC_RESOLVE, n, NULL,
6420 "References from this schema to components in the "
6421 "namespace '%s' are not allowed, since not indicated by an "
6422 "import statement", namespaceName, NULL);
6423 }
6424 return (XML_SCHEMAP_SRC_RESOLVE);
6425}
6426
6427/**
6428 * xmlSchemaParseLocalAttributes:

Callers 5

xmlSchemaParseIDCFunction · 0.85
xmlSchemaParseElementFunction · 0.85

Calls 1

xmlStrEqualFunction · 0.85

Tested by

no test coverage detected