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

Function xmlXIncludeAddNode

ThirdParty/libxml2/vtklibxml2/xinclude.c:376–566  ·  view source on GitHub ↗

* xmlXIncludeAddNode: * @ctxt: the XInclude context * @cur: the new node * * Add a new node to process to an XInclude context */

Source from the content-addressed store, hash-verified

374 * Add a new node to process to an XInclude context
375 */
376static xmlXIncludeRefPtr
377xmlXIncludeAddNode(xmlXIncludeCtxtPtr ctxt, xmlNodePtr cur) {
378 xmlXIncludeRefPtr ref = NULL;
379 xmlXIncludeRefPtr ret = NULL;
380 xmlURIPtr uri = NULL;
381 xmlChar *href = NULL;
382 xmlChar *parse = NULL;
383 xmlChar *fragment = NULL;
384 xmlChar *base = NULL;
385 xmlChar *tmp;
386 int xml = 1;
387 int local = 0;
388 int res;
389
390 if (ctxt == NULL)
391 return(NULL);
392 if (cur == NULL)
393 return(NULL);
394
395 /*
396 * read the attributes
397 */
398
399 fragment = xmlXIncludeGetProp(ctxt, cur, XINCLUDE_PARSE_XPOINTER);
400
401 href = xmlXIncludeGetProp(ctxt, cur, XINCLUDE_HREF);
402 if (href == NULL) {
403 if (fragment == NULL) {
404 xmlXIncludeErr(ctxt, cur, XML_XINCLUDE_NO_HREF,
405 "href or xpointer must be present\n", parse);
406 goto error;
407 }
408
409 href = xmlStrdup(BAD_CAST ""); /* @@@@ href is now optional */
410 if (href == NULL) {
411 xmlXIncludeErrMemory(ctxt);
412 goto error;
413 }
414 }
415
416 parse = xmlXIncludeGetProp(ctxt, cur, XINCLUDE_PARSE);
417 if (parse != NULL) {
418 if (xmlStrEqual(parse, XINCLUDE_PARSE_XML))
419 xml = 1;
420 else if (xmlStrEqual(parse, XINCLUDE_PARSE_TEXT))
421 xml = 0;
422 else {
423 xmlXIncludeErr(ctxt, cur, XML_XINCLUDE_PARSE_VALUE,
424 "invalid value %s for 'parse'\n", parse);
425 goto error;
426 }
427 }
428
429 /*
430 * Check the URL and remove any fragment identifier
431 */
432 res = xmlParseURISafe((const char *)href, &uri);
433 if (uri == NULL) {

Callers 1

xmlXIncludeExpandNodeFunction · 0.85

Calls 10

xmlXIncludeGetPropFunction · 0.85
xmlStrdupFunction · 0.85
xmlXIncludeErrMemoryFunction · 0.85
xmlStrEqualFunction · 0.85
xmlParseURISafeFunction · 0.85
xmlSaveUriFunction · 0.85
xmlNodeGetBaseSafeFunction · 0.85
xmlBuildURISafeFunction · 0.85
xmlXIncludeFreeRefFunction · 0.85
xmlFreeURIFunction · 0.85

Tested by

no test coverage detected