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

Function xmlXIncludeLoadNode

ThirdParty/libxml2/vtklibxml2/xinclude.c:1889–1933  ·  view source on GitHub ↗

* xmlXIncludeLoadNode: * @ctxt: an XInclude context * @ref: an xmlXIncludeRefPtr * * Find and load the infoset replacement for the given node. * * Returns 0 if substitution succeeded, -1 if some processing failed */

Source from the content-addressed store, hash-verified

1887 * Returns 0 if substitution succeeded, -1 if some processing failed
1888 */
1889static int
1890xmlXIncludeLoadNode(xmlXIncludeCtxtPtr ctxt, xmlXIncludeRefPtr ref) {
1891 xmlNodePtr cur;
1892 int ret;
1893
1894 if ((ctxt == NULL) || (ref == NULL))
1895 return(-1);
1896 cur = ref->elem;
1897 if (cur == NULL)
1898 return(-1);
1899
1900 if (ref->xml) {
1901 ret = xmlXIncludeLoadDoc(ctxt, ref);
1902 /* xmlXIncludeGetFragment(ctxt, cur, URI); */
1903 } else {
1904 ret = xmlXIncludeLoadTxt(ctxt, ref);
1905 }
1906
1907 if (ret < 0) {
1908 xmlNodePtr children;
1909
1910 /*
1911 * Time to try a fallback if available
1912 */
1913 children = cur->children;
1914 while (children != NULL) {
1915 if ((children->type == XML_ELEMENT_NODE) &&
1916 (children->ns != NULL) &&
1917 (xmlStrEqual(children->name, XINCLUDE_FALLBACK)) &&
1918 ((xmlStrEqual(children->ns->href, XINCLUDE_NS)) ||
1919 (xmlStrEqual(children->ns->href, XINCLUDE_OLD_NS)))) {
1920 ret = xmlXIncludeLoadFallback(ctxt, children, ref);
1921 break;
1922 }
1923 children = children->next;
1924 }
1925 }
1926 if (ret < 0) {
1927 xmlXIncludeErr(ctxt, cur, XML_XINCLUDE_NO_FALLBACK,
1928 "could not load %s, and no fallback was found\n",
1929 ref->URI);
1930 }
1931
1932 return(0);
1933}
1934
1935/**
1936 * xmlXIncludeIncludeNode:

Callers 1

xmlXIncludeExpandNodeFunction · 0.85

Calls 4

xmlXIncludeLoadDocFunction · 0.85
xmlXIncludeLoadTxtFunction · 0.85
xmlStrEqualFunction · 0.85
xmlXIncludeLoadFallbackFunction · 0.85

Tested by

no test coverage detected