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

Function xmlConvertCRNG

ThirdParty/libxml2/vtklibxml2/rngparser.c:1430–1495  ·  view source on GitHub ↗

* xmlConvertCRNG: * @schemas: pointer to the text of the compact schemas * @len: length of the schemas in bytes (or 0) * @encoding: encoding indicated by the context or NULL * * Compiles the schemas into the equivalent Relax-NG XML structure * * Returns the xmlDocPtr resulting from the compilation or * NULL in case of error */

Source from the content-addressed store, hash-verified

1428 * NULL in case of error
1429 */
1430xmlDocPtr
1431xmlConvertCRNG(const char *schemas, int len, const char *encoding) {
1432 struct _xmlCRelaxNGParserCtxt ctxt;
1433 xmlDocPtr ret = NULL;
1434
1435 if (schemas == NULL) return(NULL);
1436 if (len <= 5) len = xmlStrlen((const unsigned char *) schemas);
1437 if (len <= 0) return(NULL);
1438
1439 memset(&ctxt, 0, sizeof(ctxt));
1440 ctxt.compact = (const unsigned char *) schemas;
1441 ctxt.cur = (const unsigned char *) schemas;
1442 ctxt.end = (const unsigned char *) &schemas[len];
1443 ctxt.dict = xmlDictCreate();
1444 if (ctxt.dict == NULL)
1445 return(NULL);
1446 ctxt.doc = xmlNewDoc(NULL);
1447 if (ctxt.doc == NULL) {
1448 xmlDictFree(ctxt.dict);
1449 return(NULL);
1450 }
1451 ctxt.doc->dict = ctxt.dict;
1452 xmlDictReference(ctxt.dict);
1453
1454 ctxt.nbTokens = 0;
1455 ctxt.firstToken = 0;
1456 ctxt.key_attribute = xmlDictLookup(ctxt.dict, BAD_CAST "attribute", -1);
1457 ctxt.key_default = xmlDictLookup(ctxt.dict, BAD_CAST "default", -1);
1458 ctxt.key_datatypes = xmlDictLookup(ctxt.dict, BAD_CAST "datatypes", -1);
1459 ctxt.key_div = xmlDictLookup(ctxt.dict, BAD_CAST "div", -1);
1460 ctxt.key_element = xmlDictLookup(ctxt.dict, BAD_CAST "element", -1);
1461 ctxt.key_empty = xmlDictLookup(ctxt.dict, BAD_CAST "empty", -1);
1462 ctxt.key_external = xmlDictLookup(ctxt.dict, BAD_CAST "external", -1);
1463 ctxt.key_grammar = xmlDictLookup(ctxt.dict, BAD_CAST "grammar", -1);
1464 ctxt.key_include = xmlDictLookup(ctxt.dict, BAD_CAST "include", -1);
1465 ctxt.key_inherit = xmlDictLookup(ctxt.dict, BAD_CAST "inherit", -1);
1466 ctxt.key_list = xmlDictLookup(ctxt.dict, BAD_CAST "list", -1);
1467 ctxt.key_mixed = xmlDictLookup(ctxt.dict, BAD_CAST "mixed", -1);
1468 ctxt.key_namespace = xmlDictLookup(ctxt.dict, BAD_CAST "namespace", -1);
1469 ctxt.key_notAllowed = xmlDictLookup(ctxt.dict, BAD_CAST "notAllowed", -1);
1470 ctxt.key_parent = xmlDictLookup(ctxt.dict, BAD_CAST "parent", -1);
1471 ctxt.key_start = xmlDictLookup(ctxt.dict, BAD_CAST "start", -1);
1472 ctxt.key_string = xmlDictLookup(ctxt.dict, BAD_CAST "string", -1);
1473 ctxt.key_text = xmlDictLookup(ctxt.dict, BAD_CAST "text", -1);
1474 ctxt.key_token = xmlDictLookup(ctxt.dict, BAD_CAST "token", -1);
1475 ctxt.key_equal = xmlDictLookup(ctxt.dict, BAD_CAST "=", 1);
1476 ctxt.key_orequal = xmlDictLookup(ctxt.dict, BAD_CAST "|=", 2);
1477 ctxt.key_andequal = xmlDictLookup(ctxt.dict, BAD_CAST "&=", 2);
1478 ctxt.key_combine = xmlDictLookup(ctxt.dict, BAD_CAST "&=", 2);
1479 ctxt.key_or = xmlDictLookup(ctxt.dict, BAD_CAST "|", 1);
1480 ctxt.key_comma = xmlDictLookup(ctxt.dict, BAD_CAST ",", 1);
1481 ctxt.key_and = xmlDictLookup(ctxt.dict, BAD_CAST "&", 1);
1482 ctxt.key_choice = xmlDictLookup(ctxt.dict, BAD_CAST "choice", -1);
1483 ctxt.key_group = xmlDictLookup(ctxt.dict, BAD_CAST "group", -1);
1484 ctxt.key_interleave = xmlDictLookup(ctxt.dict, BAD_CAST "interleave", -1);
1485 ctxt.key_ref = xmlDictLookup(ctxt.dict, BAD_CAST "ref", 3);
1486 ctxt.key_define = xmlDictLookup(ctxt.dict, BAD_CAST "define", 6);
1487

Callers 1

mainFunction · 0.85

Calls 6

xmlStrlenFunction · 0.85
xmlDictCreateFunction · 0.85
xmlNewDocFunction · 0.85
xmlDictFreeFunction · 0.85
xmlDictReferenceFunction · 0.85
xmlDictLookupFunction · 0.85

Tested by

no test coverage detected