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

Function xmlSchemaLookupNamespace

ThirdParty/libxml2/vtklibxml2/xmlschemas.c:21747–21803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21745}
21746
21747static const xmlChar *
21748xmlSchemaLookupNamespace(xmlSchemaValidCtxtPtr vctxt,
21749 const xmlChar *prefix)
21750{
21751 if (vctxt->sax != NULL) {
21752 int i, j;
21753 xmlSchemaNodeInfoPtr inode;
21754
21755 for (i = vctxt->depth; i >= 0; i--) {
21756 if (vctxt->elemInfos[i]->nbNsBindings != 0) {
21757 inode = vctxt->elemInfos[i];
21758 for (j = 0; j < inode->nbNsBindings * 2; j += 2) {
21759 if (((prefix == NULL) &&
21760 (inode->nsBindings[j] == NULL)) ||
21761 ((prefix != NULL) && xmlStrEqual(prefix,
21762 inode->nsBindings[j]))) {
21763
21764 /*
21765 * Note that the namespace bindings are already
21766 * in a string dict.
21767 */
21768 return (inode->nsBindings[j+1]);
21769 }
21770 }
21771 }
21772 }
21773 return (NULL);
21774#ifdef LIBXML_READER_ENABLED
21775 } else if (vctxt->reader != NULL) {
21776 xmlChar *nsName;
21777
21778 nsName = xmlTextReaderLookupNamespace(vctxt->reader, prefix);
21779 if (nsName != NULL) {
21780 const xmlChar *ret;
21781
21782 ret = xmlDictLookup(vctxt->dict, nsName, -1);
21783 xmlFree(nsName);
21784 return (ret);
21785 } else
21786 return (NULL);
21787#endif
21788 } else {
21789 xmlNsPtr ns;
21790
21791 if ((vctxt->inode->node == NULL) ||
21792 (vctxt->inode->node->doc == NULL)) {
21793 VERROR_INT("xmlSchemaLookupNamespace",
21794 "no node or node's doc available");
21795 return (NULL);
21796 }
21797 ns = xmlSearchNs(vctxt->inode->node->doc,
21798 vctxt->inode->node, prefix);
21799 if (ns != NULL)
21800 return (ns->href);
21801 return (NULL);
21802 }
21803}
21804

Callers 3

xmlSchemaValidateQNameFunction · 0.85
xmlSchemaVExpandQNameFunction · 0.85

Calls 4

xmlStrEqualFunction · 0.85
xmlDictLookupFunction · 0.85
xmlSearchNsFunction · 0.85

Tested by

no test coverage detected