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

Function xmlParsePITarget

ThirdParty/libxml2/vtklibxml2/parser.c:5378–5411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5376 */
5377
5378const xmlChar *
5379xmlParsePITarget(xmlParserCtxtPtr ctxt) {
5380 const xmlChar *name;
5381
5382 name = xmlParseName(ctxt);
5383 if ((name != NULL) &&
5384 ((name[0] == 'x') || (name[0] == 'X')) &&
5385 ((name[1] == 'm') || (name[1] == 'M')) &&
5386 ((name[2] == 'l') || (name[2] == 'L'))) {
5387 int i;
5388 if ((name[0] == 'x') && (name[1] == 'm') &&
5389 (name[2] == 'l') && (name[3] == 0)) {
5390 xmlFatalErrMsg(ctxt, XML_ERR_RESERVED_XML_NAME,
5391 "XML declaration allowed only at the start of the document\n");
5392 return(name);
5393 } else if (name[3] == 0) {
5394 xmlFatalErr(ctxt, XML_ERR_RESERVED_XML_NAME, NULL);
5395 return(name);
5396 }
5397 for (i = 0;;i++) {
5398 if (xmlW3CPIs[i] == NULL) break;
5399 if (xmlStrEqual(name, (const xmlChar *)xmlW3CPIs[i]))
5400 return(name);
5401 }
5402 xmlWarningMsg(ctxt, XML_ERR_RESERVED_XML_NAME,
5403 "xmlParsePITarget: invalid name prefix 'xml'\n",
5404 NULL, NULL);
5405 }
5406 if ((name != NULL) && (xmlStrchr(name, ':') != NULL)) {
5407 xmlNsErr(ctxt, XML_NS_ERR_COLON,
5408 "colons are forbidden from PI names '%s'\n", name, NULL, NULL);
5409 }
5410 return(name);
5411}
5412
5413#ifdef LIBXML_CATALOG_ENABLED
5414/**

Callers 1

xmlParsePIFunction · 0.85

Calls 4

xmlParseNameFunction · 0.85
xmlFatalErrFunction · 0.85
xmlStrEqualFunction · 0.85
xmlStrchrFunction · 0.85

Tested by

no test coverage detected