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

Function xmlRelaxNGGetErrorString

ThirdParty/libxml2/vtklibxml2/relaxng.c:2075–2210  ·  view source on GitHub ↗

* xmlRelaxNGGetErrorString: * @err: the error code * @arg1: the first string argument * @arg2: the second string argument * * computes a formatted error string for the given error code and args * * Returns the error string, it must be deallocated by the caller */

Source from the content-addressed store, hash-verified

2073 * Returns the error string, it must be deallocated by the caller
2074 */
2075static xmlChar *
2076xmlRelaxNGGetErrorString(xmlRelaxNGValidErr err, const xmlChar * arg1,
2077 const xmlChar * arg2)
2078{
2079 char msg[1000];
2080 xmlChar *result;
2081
2082 if (arg1 == NULL)
2083 arg1 = BAD_CAST "";
2084 if (arg2 == NULL)
2085 arg2 = BAD_CAST "";
2086
2087 msg[0] = 0;
2088 switch (err) {
2089 case XML_RELAXNG_OK:
2090 return (NULL);
2091 case XML_RELAXNG_ERR_MEMORY:
2092 return (xmlCharStrdup("out of memory\n"));
2093 case XML_RELAXNG_ERR_TYPE:
2094 snprintf(msg, 1000, "failed to validate type %s\n", arg1);
2095 break;
2096 case XML_RELAXNG_ERR_TYPEVAL:
2097 snprintf(msg, 1000, "Type %s doesn't allow value '%s'\n", arg1,
2098 arg2);
2099 break;
2100 case XML_RELAXNG_ERR_DUPID:
2101 snprintf(msg, 1000, "ID %s redefined\n", arg1);
2102 break;
2103 case XML_RELAXNG_ERR_TYPECMP:
2104 snprintf(msg, 1000, "failed to compare type %s\n", arg1);
2105 break;
2106 case XML_RELAXNG_ERR_NOSTATE:
2107 return (xmlCharStrdup("Internal error: no state\n"));
2108 case XML_RELAXNG_ERR_NODEFINE:
2109 return (xmlCharStrdup("Internal error: no define\n"));
2110 case XML_RELAXNG_ERR_INTERNAL:
2111 snprintf(msg, 1000, "Internal error: %s\n", arg1);
2112 break;
2113 case XML_RELAXNG_ERR_LISTEXTRA:
2114 snprintf(msg, 1000, "Extra data in list: %s\n", arg1);
2115 break;
2116 case XML_RELAXNG_ERR_INTERNODATA:
2117 return (xmlCharStrdup
2118 ("Internal: interleave block has no data\n"));
2119 case XML_RELAXNG_ERR_INTERSEQ:
2120 return (xmlCharStrdup("Invalid sequence in interleave\n"));
2121 case XML_RELAXNG_ERR_INTEREXTRA:
2122 snprintf(msg, 1000, "Extra element %s in interleave\n", arg1);
2123 break;
2124 case XML_RELAXNG_ERR_ELEMNAME:
2125 snprintf(msg, 1000, "Expecting element %s, got %s\n", arg1,
2126 arg2);
2127 break;
2128 case XML_RELAXNG_ERR_ELEMNONS:
2129 snprintf(msg, 1000, "Expecting a namespace for element %s\n",
2130 arg1);
2131 break;
2132 case XML_RELAXNG_ERR_ELEMWRONGNS:

Callers 1

xmlRelaxNGShowValidErrorFunction · 0.85

Calls 2

xmlCharStrdupFunction · 0.85
xmlEscapeFormatStringFunction · 0.85

Tested by

no test coverage detected