OLD | NEW |
1 /* | 1 /* |
2 * schemas.c : implementation of the XML Schema handling and | 2 * schemas.c : implementation of the XML Schema handling and |
3 * schema validity checking | 3 * schema validity checking |
4 * | 4 * |
5 * See Copyright for the status of this software. | 5 * See Copyright for the status of this software. |
6 * | 6 * |
7 * Daniel Veillard <veillard@redhat.com> | 7 * Daniel Veillard <veillard@redhat.com> |
8 */ | 8 */ |
9 | 9 |
10 /* | 10 /* |
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, | 1078 xmlSchemaParseModelGroup(xmlSchemaParserCtxtPtr ctxt, xmlSchemaPtr schema, |
1079 xmlNodePtr node, xmlSchemaTypeType type, | 1079 xmlNodePtr node, xmlSchemaTypeType type, |
1080 int withParticle); | 1080 int withParticle); |
1081 static const xmlChar * | 1081 static const xmlChar * |
1082 xmlSchemaGetComponentTypeStr(xmlSchemaBasicItemPtr item); | 1082 xmlSchemaGetComponentTypeStr(xmlSchemaBasicItemPtr item); |
1083 static xmlSchemaTypeLinkPtr | 1083 static xmlSchemaTypeLinkPtr |
1084 xmlSchemaGetUnionSimpleTypeMemberTypes(xmlSchemaTypePtr type); | 1084 xmlSchemaGetUnionSimpleTypeMemberTypes(xmlSchemaTypePtr type); |
1085 static void | 1085 static void |
1086 xmlSchemaInternalErr(xmlSchemaAbstractCtxtPtr actxt, | 1086 xmlSchemaInternalErr(xmlSchemaAbstractCtxtPtr actxt, |
1087 const char *funcName, | 1087 const char *funcName, |
1088 » » const char *message); | 1088 » » const char *message) LIBXML_ATTR_FORMAT(3,0); |
1089 static int | 1089 static int |
1090 xmlSchemaCheckCOSSTDerivedOK(xmlSchemaAbstractCtxtPtr ctxt, | 1090 xmlSchemaCheckCOSSTDerivedOK(xmlSchemaAbstractCtxtPtr ctxt, |
1091 xmlSchemaTypePtr type, | 1091 xmlSchemaTypePtr type, |
1092 xmlSchemaTypePtr baseType, | 1092 xmlSchemaTypePtr baseType, |
1093 int subset); | 1093 int subset); |
1094 static void | 1094 static void |
1095 xmlSchemaCheckElementDeclComponent(xmlSchemaElementPtr elemDecl, | 1095 xmlSchemaCheckElementDeclComponent(xmlSchemaElementPtr elemDecl, |
1096 xmlSchemaParserCtxtPtr ctxt); | 1096 xmlSchemaParserCtxtPtr ctxt); |
1097 static void | 1097 static void |
1098 xmlSchemaComponentListFree(xmlSchemaItemListPtr list); | 1098 xmlSchemaComponentListFree(xmlSchemaItemListPtr list); |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1762 if (itemNode->ns != NULL) { | 1762 if (itemNode->ns != NULL) { |
1763 *buf = xmlStrcat(*buf, xmlSchemaFormatQName(&str, | 1763 *buf = xmlStrcat(*buf, xmlSchemaFormatQName(&str, |
1764 itemNode->ns->href, itemNode->name)); | 1764 itemNode->ns->href, itemNode->name)); |
1765 FREE_AND_NULL(str) | 1765 FREE_AND_NULL(str) |
1766 } else | 1766 } else |
1767 *buf = xmlStrcat(*buf, itemNode->name); | 1767 *buf = xmlStrcat(*buf, itemNode->name); |
1768 *buf = xmlStrcat(*buf, BAD_CAST "'"); | 1768 *buf = xmlStrcat(*buf, BAD_CAST "'"); |
1769 } | 1769 } |
1770 FREE_AND_NULL(str) | 1770 FREE_AND_NULL(str) |
1771 | 1771 |
1772 return (*buf); | 1772 return (xmlEscapeFormatString(buf)); |
1773 } | 1773 } |
1774 | 1774 |
1775 /** | 1775 /** |
1776 * xmlSchemaFormatFacetEnumSet: | 1776 * xmlSchemaFormatFacetEnumSet: |
1777 * @buf: the string buffer | 1777 * @buf: the string buffer |
1778 * @type: the type holding the enumeration facets | 1778 * @type: the type holding the enumeration facets |
1779 * | 1779 * |
1780 * Builds a string consisting of all enumeration elements. | 1780 * Builds a string consisting of all enumeration elements. |
1781 * | 1781 * |
1782 * Returns a string of all enumeration elements. | 1782 * Returns a string of all enumeration elements. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1882 * xmlSchemaPErr: | 1882 * xmlSchemaPErr: |
1883 * @ctxt: the parsing context | 1883 * @ctxt: the parsing context |
1884 * @node: the context node | 1884 * @node: the context node |
1885 * @error: the error code | 1885 * @error: the error code |
1886 * @msg: the error message | 1886 * @msg: the error message |
1887 * @str1: extra data | 1887 * @str1: extra data |
1888 * @str2: extra data | 1888 * @str2: extra data |
1889 * | 1889 * |
1890 * Handle a parser error | 1890 * Handle a parser error |
1891 */ | 1891 */ |
1892 static void | 1892 static void LIBXML_ATTR_FORMAT(4,0) |
1893 xmlSchemaPErr(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, int error, | 1893 xmlSchemaPErr(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, int error, |
1894 const char *msg, const xmlChar * str1, const xmlChar * str2) | 1894 const char *msg, const xmlChar * str1, const xmlChar * str2) |
1895 { | 1895 { |
1896 xmlGenericErrorFunc channel = NULL; | 1896 xmlGenericErrorFunc channel = NULL; |
1897 xmlStructuredErrorFunc schannel = NULL; | 1897 xmlStructuredErrorFunc schannel = NULL; |
1898 void *data = NULL; | 1898 void *data = NULL; |
1899 | 1899 |
1900 if (ctxt != NULL) { | 1900 if (ctxt != NULL) { |
1901 ctxt->nberrors++; | 1901 ctxt->nberrors++; |
1902 ctxt->err = error; | 1902 ctxt->err = error; |
(...skipping 12 matching lines...) Expand all Loading... |
1915 * @ctxt: the parsing context | 1915 * @ctxt: the parsing context |
1916 * @node: the context node | 1916 * @node: the context node |
1917 * @node: the current child | 1917 * @node: the current child |
1918 * @error: the error code | 1918 * @error: the error code |
1919 * @msg: the error message | 1919 * @msg: the error message |
1920 * @str1: extra data | 1920 * @str1: extra data |
1921 * @str2: extra data | 1921 * @str2: extra data |
1922 * | 1922 * |
1923 * Handle a parser error | 1923 * Handle a parser error |
1924 */ | 1924 */ |
1925 static void | 1925 static void LIBXML_ATTR_FORMAT(5,0) |
1926 xmlSchemaPErr2(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, | 1926 xmlSchemaPErr2(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, |
1927 xmlNodePtr child, int error, | 1927 xmlNodePtr child, int error, |
1928 const char *msg, const xmlChar * str1, const xmlChar * str2) | 1928 const char *msg, const xmlChar * str1, const xmlChar * str2) |
1929 { | 1929 { |
1930 if (child != NULL) | 1930 if (child != NULL) |
1931 xmlSchemaPErr(ctxt, child, error, msg, str1, str2); | 1931 xmlSchemaPErr(ctxt, child, error, msg, str1, str2); |
1932 else | 1932 else |
1933 xmlSchemaPErr(ctxt, node, error, msg, str1, str2); | 1933 xmlSchemaPErr(ctxt, node, error, msg, str1, str2); |
1934 } | 1934 } |
1935 | 1935 |
1936 | 1936 |
1937 /** | 1937 /** |
1938 * xmlSchemaPErrExt: | 1938 * xmlSchemaPErrExt: |
1939 * @ctxt: the parsing context | 1939 * @ctxt: the parsing context |
1940 * @node: the context node | 1940 * @node: the context node |
1941 * @error: the error code | 1941 * @error: the error code |
1942 * @strData1: extra data | 1942 * @strData1: extra data |
1943 * @strData2: extra data | 1943 * @strData2: extra data |
1944 * @strData3: extra data | 1944 * @strData3: extra data |
1945 * @msg: the message | 1945 * @msg: the message |
1946 * @str1: extra parameter for the message display | 1946 * @str1: extra parameter for the message display |
1947 * @str2: extra parameter for the message display | 1947 * @str2: extra parameter for the message display |
1948 * @str3: extra parameter for the message display | 1948 * @str3: extra parameter for the message display |
1949 * @str4: extra parameter for the message display | 1949 * @str4: extra parameter for the message display |
1950 * @str5: extra parameter for the message display | 1950 * @str5: extra parameter for the message display |
1951 * | 1951 * |
1952 * Handle a parser error | 1952 * Handle a parser error |
1953 */ | 1953 */ |
1954 static void | 1954 static void LIBXML_ATTR_FORMAT(7,0) |
1955 xmlSchemaPErrExt(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, int error, | 1955 xmlSchemaPErrExt(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node, int error, |
1956 const xmlChar * strData1, const xmlChar * strData2, | 1956 const xmlChar * strData1, const xmlChar * strData2, |
1957 const xmlChar * strData3, const char *msg, const xmlChar * str1, | 1957 const xmlChar * strData3, const char *msg, const xmlChar * str1, |
1958 const xmlChar * str2, const xmlChar * str3, const xmlChar * str4
, | 1958 const xmlChar * str2, const xmlChar * str3, const xmlChar * str4
, |
1959 const xmlChar * str5) | 1959 const xmlChar * str5) |
1960 { | 1960 { |
1961 | 1961 |
1962 xmlGenericErrorFunc channel = NULL; | 1962 xmlGenericErrorFunc channel = NULL; |
1963 xmlStructuredErrorFunc schannel = NULL; | 1963 xmlStructuredErrorFunc schannel = NULL; |
1964 void *data = NULL; | 1964 void *data = NULL; |
(...skipping 30 matching lines...) Expand all Loading... |
1995 const char *extra, xmlNodePtr node) | 1995 const char *extra, xmlNodePtr node) |
1996 { | 1996 { |
1997 if (ctxt != NULL) { | 1997 if (ctxt != NULL) { |
1998 ctxt->nberrors++; | 1998 ctxt->nberrors++; |
1999 ctxt->err = XML_SCHEMAV_INTERNAL; | 1999 ctxt->err = XML_SCHEMAV_INTERNAL; |
2000 } | 2000 } |
2001 __xmlSimpleError(XML_FROM_SCHEMASV, XML_ERR_NO_MEMORY, node, NULL, | 2001 __xmlSimpleError(XML_FROM_SCHEMASV, XML_ERR_NO_MEMORY, node, NULL, |
2002 extra); | 2002 extra); |
2003 } | 2003 } |
2004 | 2004 |
2005 static void | 2005 static void LIBXML_ATTR_FORMAT(2,0) |
2006 xmlSchemaPSimpleInternalErr(xmlNodePtr node, | 2006 xmlSchemaPSimpleInternalErr(xmlNodePtr node, |
2007 const char *msg, const xmlChar *str) | 2007 const char *msg, const xmlChar *str) |
2008 { | 2008 { |
2009 __xmlSimpleError(XML_FROM_SCHEMASP, XML_SCHEMAP_INTERNAL, node, | 2009 __xmlSimpleError(XML_FROM_SCHEMASP, XML_SCHEMAP_INTERNAL, node, |
2010 msg, (const char *) str); | 2010 msg, (const char *) str); |
2011 } | 2011 } |
2012 | 2012 |
2013 #define WXS_ERROR_TYPE_ERROR 1 | 2013 #define WXS_ERROR_TYPE_ERROR 1 |
2014 #define WXS_ERROR_TYPE_WARNING 2 | 2014 #define WXS_ERROR_TYPE_WARNING 2 |
2015 /** | 2015 /** |
2016 * xmlSchemaErr3: | 2016 * xmlSchemaErr4Line: |
2017 * @ctxt: the validation context | 2017 * @ctxt: the validation context |
| 2018 * @errorLevel: the error level |
| 2019 * @error: the error code |
2018 * @node: the context node | 2020 * @node: the context node |
2019 * @error: the error code | 2021 * @line: the line number |
2020 * @msg: the error message | 2022 * @msg: the error message |
2021 * @str1: extra data | 2023 * @str1: extra data |
2022 * @str2: extra data | 2024 * @str2: extra data |
2023 * @str3: extra data | 2025 * @str3: extra data |
| 2026 * @str4: extra data |
2024 * | 2027 * |
2025 * Handle a validation error | 2028 * Handle a validation error |
2026 */ | 2029 */ |
2027 static void | 2030 static void LIBXML_ATTR_FORMAT(6,0) |
2028 xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt, | 2031 xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt, |
2029 xmlErrorLevel errorLevel, | 2032 xmlErrorLevel errorLevel, |
2030 int error, xmlNodePtr node, int line, const char *msg, | 2033 int error, xmlNodePtr node, int line, const char *msg, |
2031 const xmlChar *str1, const xmlChar *str2, | 2034 const xmlChar *str1, const xmlChar *str2, |
2032 const xmlChar *str3, const xmlChar *str4) | 2035 const xmlChar *str3, const xmlChar *str4) |
2033 { | 2036 { |
2034 xmlStructuredErrorFunc schannel = NULL; | 2037 xmlStructuredErrorFunc schannel = NULL; |
2035 xmlGenericErrorFunc channel = NULL; | 2038 xmlGenericErrorFunc channel = NULL; |
2036 void *data = NULL; | 2039 void *data = NULL; |
2037 | 2040 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2132 * @ctxt: the validation context | 2135 * @ctxt: the validation context |
2133 * @node: the context node | 2136 * @node: the context node |
2134 * @error: the error code | 2137 * @error: the error code |
2135 * @msg: the error message | 2138 * @msg: the error message |
2136 * @str1: extra data | 2139 * @str1: extra data |
2137 * @str2: extra data | 2140 * @str2: extra data |
2138 * @str3: extra data | 2141 * @str3: extra data |
2139 * | 2142 * |
2140 * Handle a validation error | 2143 * Handle a validation error |
2141 */ | 2144 */ |
2142 static void | 2145 static void LIBXML_ATTR_FORMAT(4,0) |
2143 xmlSchemaErr3(xmlSchemaAbstractCtxtPtr actxt, | 2146 xmlSchemaErr3(xmlSchemaAbstractCtxtPtr actxt, |
2144 int error, xmlNodePtr node, const char *msg, | 2147 int error, xmlNodePtr node, const char *msg, |
2145 const xmlChar *str1, const xmlChar *str2, const xmlChar *str3) | 2148 const xmlChar *str1, const xmlChar *str2, const xmlChar *str3) |
2146 { | 2149 { |
2147 xmlSchemaErr4Line(actxt, XML_ERR_ERROR, error, node, 0, | 2150 xmlSchemaErr4Line(actxt, XML_ERR_ERROR, error, node, 0, |
2148 msg, str1, str2, str3, NULL); | 2151 msg, str1, str2, str3, NULL); |
2149 } | 2152 } |
2150 | 2153 |
2151 static void | 2154 static void LIBXML_ATTR_FORMAT(4,0) |
2152 xmlSchemaErr4(xmlSchemaAbstractCtxtPtr actxt, | 2155 xmlSchemaErr4(xmlSchemaAbstractCtxtPtr actxt, |
2153 int error, xmlNodePtr node, const char *msg, | 2156 int error, xmlNodePtr node, const char *msg, |
2154 const xmlChar *str1, const xmlChar *str2, | 2157 const xmlChar *str1, const xmlChar *str2, |
2155 const xmlChar *str3, const xmlChar *str4) | 2158 const xmlChar *str3, const xmlChar *str4) |
2156 { | 2159 { |
2157 xmlSchemaErr4Line(actxt, XML_ERR_ERROR, error, node, 0, | 2160 xmlSchemaErr4Line(actxt, XML_ERR_ERROR, error, node, 0, |
2158 msg, str1, str2, str3, str4); | 2161 msg, str1, str2, str3, str4); |
2159 } | 2162 } |
2160 | 2163 |
2161 static void | 2164 static void LIBXML_ATTR_FORMAT(4,0) |
2162 xmlSchemaErr(xmlSchemaAbstractCtxtPtr actxt, | 2165 xmlSchemaErr(xmlSchemaAbstractCtxtPtr actxt, |
2163 int error, xmlNodePtr node, const char *msg, | 2166 int error, xmlNodePtr node, const char *msg, |
2164 const xmlChar *str1, const xmlChar *str2) | 2167 const xmlChar *str1, const xmlChar *str2) |
2165 { | 2168 { |
2166 xmlSchemaErr4(actxt, error, node, msg, str1, str2, NULL, NULL); | 2169 xmlSchemaErr4(actxt, error, node, msg, str1, str2, NULL, NULL); |
2167 } | 2170 } |
2168 | 2171 |
2169 static xmlChar * | 2172 static xmlChar * |
2170 xmlSchemaFormatNodeForError(xmlChar ** msg, | 2173 xmlSchemaFormatNodeForError(xmlChar ** msg, |
2171 xmlSchemaAbstractCtxtPtr actxt, | 2174 xmlSchemaAbstractCtxtPtr actxt, |
2172 xmlNodePtr node) | 2175 xmlNodePtr node) |
2173 { | 2176 { |
2174 xmlChar *str = NULL; | 2177 xmlChar *str = NULL; |
2175 | 2178 |
2176 *msg = NULL; | 2179 *msg = NULL; |
2177 if ((node != NULL) && | 2180 if ((node != NULL) && |
2178 (node->type != XML_ELEMENT_NODE) && | 2181 (node->type != XML_ELEMENT_NODE) && |
2179 (node->type != XML_ATTRIBUTE_NODE)) | 2182 (node->type != XML_ATTRIBUTE_NODE)) |
2180 { | 2183 { |
2181 /* | 2184 /* |
2182 * Don't try to format other nodes than element and | 2185 * Don't try to format other nodes than element and |
2183 * attribute nodes. | 2186 * attribute nodes. |
2184 » * Play save and return an empty string. | 2187 » * Play safe and return an empty string. |
2185 */ | 2188 */ |
2186 *msg = xmlStrdup(BAD_CAST ""); | 2189 *msg = xmlStrdup(BAD_CAST ""); |
2187 return(*msg); | 2190 return(*msg); |
2188 } | 2191 } |
2189 if (node != NULL) { | 2192 if (node != NULL) { |
2190 /* | 2193 /* |
2191 * Work on tree nodes. | 2194 * Work on tree nodes. |
2192 */ | 2195 */ |
2193 if (node->type == XML_ATTRIBUTE_NODE) { | 2196 if (node->type == XML_ATTRIBUTE_NODE) { |
2194 xmlNodePtr elem = node->parent; | 2197 xmlNodePtr elem = node->parent; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2239 } else if (actxt->type == XML_SCHEMA_CTXT_PARSER) { | 2242 } else if (actxt->type == XML_SCHEMA_CTXT_PARSER) { |
2240 /* | 2243 /* |
2241 * Hmm, no node while parsing? | 2244 * Hmm, no node while parsing? |
2242 * Return an empty string, in case NULL will break something. | 2245 * Return an empty string, in case NULL will break something. |
2243 */ | 2246 */ |
2244 *msg = xmlStrdup(BAD_CAST ""); | 2247 *msg = xmlStrdup(BAD_CAST ""); |
2245 } else { | 2248 } else { |
2246 TODO | 2249 TODO |
2247 return (NULL); | 2250 return (NULL); |
2248 } | 2251 } |
| 2252 |
| 2253 /* |
| 2254 * xmlSchemaFormatItemForReport() also returns an escaped format |
| 2255 * string, so do this before calling it below (in the future). |
| 2256 */ |
| 2257 xmlEscapeFormatString(msg); |
| 2258 |
2249 /* | 2259 /* |
2250 * VAL TODO: The output of the given schema component is currently | 2260 * VAL TODO: The output of the given schema component is currently |
2251 * disabled. | 2261 * disabled. |
2252 */ | 2262 */ |
2253 #if 0 | 2263 #if 0 |
2254 if ((type != NULL) && (xmlSchemaIsGlobalItem(type))) { | 2264 if ((type != NULL) && (xmlSchemaIsGlobalItem(type))) { |
2255 *msg = xmlStrcat(*msg, BAD_CAST " ["); | 2265 *msg = xmlStrcat(*msg, BAD_CAST " ["); |
2256 *msg = xmlStrcat(*msg, xmlSchemaFormatItemForReport(&str, | 2266 *msg = xmlStrcat(*msg, xmlSchemaFormatItemForReport(&str, |
2257 NULL, type, NULL, 0)); | 2267 NULL, type, NULL, 0)); |
2258 FREE_AND_NULL(str) | 2268 FREE_AND_NULL(str) |
2259 *msg = xmlStrcat(*msg, BAD_CAST "]"); | 2269 *msg = xmlStrcat(*msg, BAD_CAST "]"); |
2260 } | 2270 } |
2261 #endif | 2271 #endif |
2262 return (*msg); | 2272 return (*msg); |
2263 } | 2273 } |
2264 | 2274 |
2265 static void | 2275 static void LIBXML_ATTR_FORMAT(3,0) |
2266 xmlSchemaInternalErr2(xmlSchemaAbstractCtxtPtr actxt, | 2276 xmlSchemaInternalErr2(xmlSchemaAbstractCtxtPtr actxt, |
2267 const char *funcName, | 2277 const char *funcName, |
2268 const char *message, | 2278 const char *message, |
2269 const xmlChar *str1, | 2279 const xmlChar *str1, |
2270 const xmlChar *str2) | 2280 const xmlChar *str2) |
2271 { | 2281 { |
2272 xmlChar *msg = NULL; | 2282 xmlChar *msg = NULL; |
2273 | 2283 |
2274 if (actxt == NULL) | 2284 if (actxt == NULL) |
2275 return; | 2285 return; |
2276 msg = xmlStrdup(BAD_CAST "Internal error: "); | 2286 msg = xmlStrdup(BAD_CAST "Internal error: %s, "); |
2277 msg = xmlStrcat(msg, BAD_CAST funcName); | |
2278 msg = xmlStrcat(msg, BAD_CAST ", "); | |
2279 msg = xmlStrcat(msg, BAD_CAST message); | 2287 msg = xmlStrcat(msg, BAD_CAST message); |
2280 msg = xmlStrcat(msg, BAD_CAST ".\n"); | 2288 msg = xmlStrcat(msg, BAD_CAST ".\n"); |
2281 | 2289 |
2282 if (actxt->type == XML_SCHEMA_CTXT_VALIDATOR) | 2290 if (actxt->type == XML_SCHEMA_CTXT_VALIDATOR) |
2283 » xmlSchemaErr(actxt, XML_SCHEMAV_INTERNAL, NULL, | 2291 » xmlSchemaErr3(actxt, XML_SCHEMAV_INTERNAL, NULL, |
2284 » (const char *) msg, str1, str2); | 2292 » (const char *) msg, (const xmlChar *) funcName, str1, str2); |
2285 | |
2286 else if (actxt->type == XML_SCHEMA_CTXT_PARSER) | 2293 else if (actxt->type == XML_SCHEMA_CTXT_PARSER) |
2287 » xmlSchemaErr(actxt, XML_SCHEMAP_INTERNAL, NULL, | 2294 » xmlSchemaErr3(actxt, XML_SCHEMAP_INTERNAL, NULL, |
2288 » (const char *) msg, str1, str2); | 2295 » (const char *) msg, (const xmlChar *) funcName, str1, str2); |
2289 | 2296 |
2290 FREE_AND_NULL(msg) | 2297 FREE_AND_NULL(msg) |
2291 } | 2298 } |
2292 | 2299 |
2293 static void | 2300 static void LIBXML_ATTR_FORMAT(3,0) |
2294 xmlSchemaInternalErr(xmlSchemaAbstractCtxtPtr actxt, | 2301 xmlSchemaInternalErr(xmlSchemaAbstractCtxtPtr actxt, |
2295 const char *funcName, | 2302 const char *funcName, |
2296 const char *message) | 2303 const char *message) |
2297 { | 2304 { |
2298 xmlSchemaInternalErr2(actxt, funcName, message, NULL, NULL); | 2305 xmlSchemaInternalErr2(actxt, funcName, message, NULL, NULL); |
2299 } | 2306 } |
2300 | 2307 |
2301 #if 0 | 2308 #if 0 |
2302 static void | 2309 static void LIBXML_ATTR_FORMAT(3,0) |
2303 xmlSchemaPInternalErr(xmlSchemaParserCtxtPtr pctxt, | 2310 xmlSchemaPInternalErr(xmlSchemaParserCtxtPtr pctxt, |
2304 const char *funcName, | 2311 const char *funcName, |
2305 const char *message, | 2312 const char *message, |
2306 const xmlChar *str1, | 2313 const xmlChar *str1, |
2307 const xmlChar *str2) | 2314 const xmlChar *str2) |
2308 { | 2315 { |
2309 xmlSchemaInternalErr2(ACTXT_CAST pctxt, funcName, message, | 2316 xmlSchemaInternalErr2(ACTXT_CAST pctxt, funcName, message, |
2310 str1, str2); | 2317 str1, str2); |
2311 } | 2318 } |
2312 #endif | 2319 #endif |
2313 | 2320 |
2314 static void | 2321 static void LIBXML_ATTR_FORMAT(5,0) |
2315 xmlSchemaCustomErr4(xmlSchemaAbstractCtxtPtr actxt, | 2322 xmlSchemaCustomErr4(xmlSchemaAbstractCtxtPtr actxt, |
2316 xmlParserErrors error, | 2323 xmlParserErrors error, |
2317 xmlNodePtr node, | 2324 xmlNodePtr node, |
2318 xmlSchemaBasicItemPtr item, | 2325 xmlSchemaBasicItemPtr item, |
2319 const char *message, | 2326 const char *message, |
2320 const xmlChar *str1, const xmlChar *str2, | 2327 const xmlChar *str1, const xmlChar *str2, |
2321 const xmlChar *str3, const xmlChar *str4) | 2328 const xmlChar *str3, const xmlChar *str4) |
2322 { | 2329 { |
2323 xmlChar *msg = NULL; | 2330 xmlChar *msg = NULL; |
2324 | 2331 |
2325 if ((node == NULL) && (item != NULL) && | 2332 if ((node == NULL) && (item != NULL) && |
2326 (actxt->type == XML_SCHEMA_CTXT_PARSER)) { | 2333 (actxt->type == XML_SCHEMA_CTXT_PARSER)) { |
2327 node = WXS_ITEM_NODE(item); | 2334 node = WXS_ITEM_NODE(item); |
2328 xmlSchemaFormatItemForReport(&msg, NULL, item, NULL); | 2335 xmlSchemaFormatItemForReport(&msg, NULL, item, NULL); |
2329 msg = xmlStrcat(msg, BAD_CAST ": "); | 2336 msg = xmlStrcat(msg, BAD_CAST ": "); |
2330 } else | 2337 } else |
2331 xmlSchemaFormatNodeForError(&msg, actxt, node); | 2338 xmlSchemaFormatNodeForError(&msg, actxt, node); |
2332 msg = xmlStrcat(msg, (const xmlChar *) message); | 2339 msg = xmlStrcat(msg, (const xmlChar *) message); |
2333 msg = xmlStrcat(msg, BAD_CAST ".\n"); | 2340 msg = xmlStrcat(msg, BAD_CAST ".\n"); |
2334 xmlSchemaErr4(actxt, error, node, | 2341 xmlSchemaErr4(actxt, error, node, |
2335 (const char *) msg, str1, str2, str3, str4); | 2342 (const char *) msg, str1, str2, str3, str4); |
2336 FREE_AND_NULL(msg) | 2343 FREE_AND_NULL(msg) |
2337 } | 2344 } |
2338 | 2345 |
2339 static void | 2346 static void LIBXML_ATTR_FORMAT(5,0) |
2340 xmlSchemaCustomErr(xmlSchemaAbstractCtxtPtr actxt, | 2347 xmlSchemaCustomErr(xmlSchemaAbstractCtxtPtr actxt, |
2341 xmlParserErrors error, | 2348 xmlParserErrors error, |
2342 xmlNodePtr node, | 2349 xmlNodePtr node, |
2343 xmlSchemaBasicItemPtr item, | 2350 xmlSchemaBasicItemPtr item, |
2344 const char *message, | 2351 const char *message, |
2345 const xmlChar *str1, | 2352 const xmlChar *str1, |
2346 const xmlChar *str2) | 2353 const xmlChar *str2) |
2347 { | 2354 { |
2348 xmlSchemaCustomErr4(actxt, error, node, item, | 2355 xmlSchemaCustomErr4(actxt, error, node, item, |
2349 message, str1, str2, NULL, NULL); | 2356 message, str1, str2, NULL, NULL); |
2350 } | 2357 } |
2351 | 2358 |
2352 | 2359 |
2353 | 2360 |
2354 static void | 2361 static void LIBXML_ATTR_FORMAT(5,0) |
2355 xmlSchemaCustomWarning(xmlSchemaAbstractCtxtPtr actxt, | 2362 xmlSchemaCustomWarning(xmlSchemaAbstractCtxtPtr actxt, |
2356 xmlParserErrors error, | 2363 xmlParserErrors error, |
2357 xmlNodePtr node, | 2364 xmlNodePtr node, |
2358 xmlSchemaTypePtr type ATTRIBUTE_UNUSED, | 2365 xmlSchemaTypePtr type ATTRIBUTE_UNUSED, |
2359 const char *message, | 2366 const char *message, |
2360 const xmlChar *str1, | 2367 const xmlChar *str1, |
2361 const xmlChar *str2, | 2368 const xmlChar *str2, |
2362 const xmlChar *str3) | 2369 const xmlChar *str3) |
2363 { | 2370 { |
2364 xmlChar *msg = NULL; | 2371 xmlChar *msg = NULL; |
2365 | 2372 |
2366 xmlSchemaFormatNodeForError(&msg, actxt, node); | 2373 xmlSchemaFormatNodeForError(&msg, actxt, node); |
2367 msg = xmlStrcat(msg, (const xmlChar *) message); | 2374 msg = xmlStrcat(msg, (const xmlChar *) message); |
2368 msg = xmlStrcat(msg, BAD_CAST ".\n"); | 2375 msg = xmlStrcat(msg, BAD_CAST ".\n"); |
2369 | 2376 |
2370 /* URGENT TODO: Set the error code to something sane. */ | 2377 /* URGENT TODO: Set the error code to something sane. */ |
2371 xmlSchemaErr4Line(actxt, XML_ERR_WARNING, error, node, 0, | 2378 xmlSchemaErr4Line(actxt, XML_ERR_WARNING, error, node, 0, |
2372 (const char *) msg, str1, str2, str3, NULL); | 2379 (const char *) msg, str1, str2, str3, NULL); |
2373 | 2380 |
2374 FREE_AND_NULL(msg) | 2381 FREE_AND_NULL(msg) |
2375 } | 2382 } |
2376 | 2383 |
2377 | 2384 |
2378 | 2385 |
2379 static void | 2386 static void LIBXML_ATTR_FORMAT(5,0) |
2380 xmlSchemaKeyrefErr(xmlSchemaValidCtxtPtr vctxt, | 2387 xmlSchemaKeyrefErr(xmlSchemaValidCtxtPtr vctxt, |
2381 xmlParserErrors error, | 2388 xmlParserErrors error, |
2382 xmlSchemaPSVIIDCNodePtr idcNode, | 2389 xmlSchemaPSVIIDCNodePtr idcNode, |
2383 xmlSchemaTypePtr type ATTRIBUTE_UNUSED, | 2390 xmlSchemaTypePtr type ATTRIBUTE_UNUSED, |
2384 const char *message, | 2391 const char *message, |
2385 const xmlChar *str1, | 2392 const xmlChar *str1, |
2386 const xmlChar *str2) | 2393 const xmlChar *str2) |
2387 { | 2394 { |
2388 xmlChar *msg = NULL, *qname = NULL; | 2395 xmlChar *msg = NULL, *qname = NULL; |
2389 | 2396 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2469 else if (WXS_IS_LIST(type)) | 2476 else if (WXS_IS_LIST(type)) |
2470 msg = xmlStrcat(msg, BAD_CAST "list type"); | 2477 msg = xmlStrcat(msg, BAD_CAST "list type"); |
2471 else if (WXS_IS_UNION(type)) | 2478 else if (WXS_IS_UNION(type)) |
2472 msg = xmlStrcat(msg, BAD_CAST "union type"); | 2479 msg = xmlStrcat(msg, BAD_CAST "union type"); |
2473 | 2480 |
2474 if (xmlSchemaIsGlobalItem(type)) { | 2481 if (xmlSchemaIsGlobalItem(type)) { |
2475 xmlChar *str = NULL; | 2482 xmlChar *str = NULL; |
2476 msg = xmlStrcat(msg, BAD_CAST " '"); | 2483 msg = xmlStrcat(msg, BAD_CAST " '"); |
2477 if (type->builtInType != 0) { | 2484 if (type->builtInType != 0) { |
2478 msg = xmlStrcat(msg, BAD_CAST "xs:"); | 2485 msg = xmlStrcat(msg, BAD_CAST "xs:"); |
2479 » msg = xmlStrcat(msg, type->name); | 2486 » str = xmlStrdup(type->name); |
2480 » } else | 2487 » } else { |
2481 » msg = xmlStrcat(msg, | 2488 » const xmlChar *qName = xmlSchemaFormatQName(&str, type->targetNamesp
ace, type->name); |
2482 » » xmlSchemaFormatQName(&str, | 2489 » if (!str) |
2483 » » type->targetNamespace, type->name)); | 2490 » » str = xmlStrdup(qName); |
| 2491 » } |
| 2492 » msg = xmlStrcat(msg, xmlEscapeFormatString(&str)); |
2484 msg = xmlStrcat(msg, BAD_CAST "'"); | 2493 msg = xmlStrcat(msg, BAD_CAST "'"); |
2485 FREE_AND_NULL(str); | 2494 FREE_AND_NULL(str); |
2486 } | 2495 } |
2487 msg = xmlStrcat(msg, BAD_CAST ".\n"); | 2496 msg = xmlStrcat(msg, BAD_CAST ".\n"); |
2488 if (displayValue || (xmlSchemaEvalErrorNodeType(actxt, node) == | 2497 if (displayValue || (xmlSchemaEvalErrorNodeType(actxt, node) == |
2489 XML_ATTRIBUTE_NODE)) | 2498 XML_ATTRIBUTE_NODE)) |
2490 xmlSchemaErr(actxt, error, node, (const char *) msg, value, NULL); | 2499 xmlSchemaErr(actxt, error, node, (const char *) msg, value, NULL); |
2491 else | 2500 else |
2492 xmlSchemaErr(actxt, error, node, (const char *) msg, NULL, NULL); | 2501 xmlSchemaErr(actxt, error, node, (const char *) msg, NULL, NULL); |
2493 FREE_AND_NULL(msg) | 2502 FREE_AND_NULL(msg) |
(...skipping 24 matching lines...) Expand all Loading... |
2518 | 2527 |
2519 xmlSchemaFormatNodeForError(&msg, actxt, node); | 2528 xmlSchemaFormatNodeForError(&msg, actxt, node); |
2520 msg = xmlStrcat(msg, BAD_CAST "The attribute '%s' is not allowed.\n"); | 2529 msg = xmlStrcat(msg, BAD_CAST "The attribute '%s' is not allowed.\n"); |
2521 xmlSchemaErr(actxt, error, node, (const char *) msg, | 2530 xmlSchemaErr(actxt, error, node, (const char *) msg, |
2522 xmlSchemaFormatErrorNodeQName(&str, (xmlSchemaNodeInfoPtr) ni, node), | 2531 xmlSchemaFormatErrorNodeQName(&str, (xmlSchemaNodeInfoPtr) ni, node), |
2523 NULL); | 2532 NULL); |
2524 FREE_AND_NULL(str) | 2533 FREE_AND_NULL(str) |
2525 FREE_AND_NULL(msg) | 2534 FREE_AND_NULL(msg) |
2526 } | 2535 } |
2527 | 2536 |
2528 static void | 2537 static void LIBXML_ATTR_FORMAT(5,0) |
2529 xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, | 2538 xmlSchemaComplexTypeErr(xmlSchemaAbstractCtxtPtr actxt, |
2530 xmlParserErrors error, | 2539 xmlParserErrors error, |
2531 xmlNodePtr node, | 2540 xmlNodePtr node, |
2532 xmlSchemaTypePtr type ATTRIBUTE_UNUSED, | 2541 xmlSchemaTypePtr type ATTRIBUTE_UNUSED, |
2533 const char *message, | 2542 const char *message, |
2534 int nbval, | 2543 int nbval, |
2535 int nbneg, | 2544 int nbneg, |
2536 xmlChar **values) | 2545 xmlChar **values) |
2537 { | 2546 { |
2538 xmlChar *str = NULL, *msg = NULL; | 2547 xmlChar *str = NULL, *msg = NULL; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2610 continue; | 2619 continue; |
2611 } | 2620 } |
2612 } | 2621 } |
2613 str = xmlStrcat(str, BAD_CAST localName); | 2622 str = xmlStrcat(str, BAD_CAST localName); |
2614 FREE_AND_NULL(localName); | 2623 FREE_AND_NULL(localName); |
2615 | 2624 |
2616 if (i < nbval + nbneg -1) | 2625 if (i < nbval + nbneg -1) |
2617 str = xmlStrcat(str, BAD_CAST ", "); | 2626 str = xmlStrcat(str, BAD_CAST ", "); |
2618 } | 2627 } |
2619 str = xmlStrcat(str, BAD_CAST " ).\n"); | 2628 str = xmlStrcat(str, BAD_CAST " ).\n"); |
2620 » msg = xmlStrcat(msg, BAD_CAST str); | 2629 » msg = xmlStrcat(msg, xmlEscapeFormatString(&str)); |
2621 FREE_AND_NULL(str) | 2630 FREE_AND_NULL(str) |
2622 } else | 2631 } else |
2623 msg = xmlStrcat(msg, BAD_CAST "\n"); | 2632 msg = xmlStrcat(msg, BAD_CAST "\n"); |
2624 xmlSchemaErr(actxt, error, node, (const char *) msg, NULL, NULL); | 2633 xmlSchemaErr(actxt, error, node, (const char *) msg, NULL, NULL); |
2625 xmlFree(msg); | 2634 xmlFree(msg); |
2626 } | 2635 } |
2627 | 2636 |
2628 static void | 2637 static void LIBXML_ATTR_FORMAT(8,0) |
2629 xmlSchemaFacetErr(xmlSchemaAbstractCtxtPtr actxt, | 2638 xmlSchemaFacetErr(xmlSchemaAbstractCtxtPtr actxt, |
2630 xmlParserErrors error, | 2639 xmlParserErrors error, |
2631 xmlNodePtr node, | 2640 xmlNodePtr node, |
2632 const xmlChar *value, | 2641 const xmlChar *value, |
2633 unsigned long length, | 2642 unsigned long length, |
2634 xmlSchemaTypePtr type, | 2643 xmlSchemaTypePtr type, |
2635 xmlSchemaFacetPtr facet, | 2644 xmlSchemaFacetPtr facet, |
2636 const char *message, | 2645 const char *message, |
2637 const xmlChar *str1, | 2646 const xmlChar *str1, |
2638 const xmlChar *str2) | 2647 const xmlChar *str2) |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2909 * @itemDes: the designation of the schema item | 2918 * @itemDes: the designation of the schema item |
2910 * @item: the schema item | 2919 * @item: the schema item |
2911 * @itemElem: the node of the schema item | 2920 * @itemElem: the node of the schema item |
2912 * @message: the error message | 2921 * @message: the error message |
2913 * @str1: an optional param for the error message | 2922 * @str1: an optional param for the error message |
2914 * @str2: an optional param for the error message | 2923 * @str2: an optional param for the error message |
2915 * @str3: an optional param for the error message | 2924 * @str3: an optional param for the error message |
2916 * | 2925 * |
2917 * Reports an error during parsing. | 2926 * Reports an error during parsing. |
2918 */ | 2927 */ |
2919 static void | 2928 static void LIBXML_ATTR_FORMAT(5,0) |
2920 xmlSchemaPCustomErrExt(xmlSchemaParserCtxtPtr ctxt, | 2929 xmlSchemaPCustomErrExt(xmlSchemaParserCtxtPtr ctxt, |
2921 xmlParserErrors error, | 2930 xmlParserErrors error, |
2922 xmlSchemaBasicItemPtr item, | 2931 xmlSchemaBasicItemPtr item, |
2923 xmlNodePtr itemElem, | 2932 xmlNodePtr itemElem, |
2924 const char *message, | 2933 const char *message, |
2925 const xmlChar *str1, | 2934 const xmlChar *str1, |
2926 const xmlChar *str2, | 2935 const xmlChar *str2, |
2927 const xmlChar *str3) | 2936 const xmlChar *str3) |
2928 { | 2937 { |
2929 xmlChar *des = NULL, *msg = NULL; | 2938 xmlChar *des = NULL, *msg = NULL; |
(...skipping 15 matching lines...) Expand all Loading... |
2945 * @ctxt: the schema parser context | 2954 * @ctxt: the schema parser context |
2946 * @error: the error code | 2955 * @error: the error code |
2947 * @itemDes: the designation of the schema item | 2956 * @itemDes: the designation of the schema item |
2948 * @item: the schema item | 2957 * @item: the schema item |
2949 * @itemElem: the node of the schema item | 2958 * @itemElem: the node of the schema item |
2950 * @message: the error message | 2959 * @message: the error message |
2951 * @str1: the optional param for the error message | 2960 * @str1: the optional param for the error message |
2952 * | 2961 * |
2953 * Reports an error during parsing. | 2962 * Reports an error during parsing. |
2954 */ | 2963 */ |
2955 static void | 2964 static void LIBXML_ATTR_FORMAT(5,0) |
2956 xmlSchemaPCustomErr(xmlSchemaParserCtxtPtr ctxt, | 2965 xmlSchemaPCustomErr(xmlSchemaParserCtxtPtr ctxt, |
2957 xmlParserErrors error, | 2966 xmlParserErrors error, |
2958 xmlSchemaBasicItemPtr item, | 2967 xmlSchemaBasicItemPtr item, |
2959 xmlNodePtr itemElem, | 2968 xmlNodePtr itemElem, |
2960 const char *message, | 2969 const char *message, |
2961 const xmlChar *str1) | 2970 const xmlChar *str1) |
2962 { | 2971 { |
2963 xmlSchemaPCustomErrExt(ctxt, error, item, itemElem, message, | 2972 xmlSchemaPCustomErrExt(ctxt, error, item, itemElem, message, |
2964 str1, NULL, NULL); | 2973 str1, NULL, NULL); |
2965 } | 2974 } |
2966 | 2975 |
2967 /** | 2976 /** |
2968 * xmlSchemaPAttrUseErr: | 2977 * xmlSchemaPAttrUseErr: |
2969 * @ctxt: the schema parser context | 2978 * @ctxt: the schema parser context |
2970 * @error: the error code | 2979 * @error: the error code |
2971 * @itemDes: the designation of the schema type | 2980 * @itemDes: the designation of the schema type |
2972 * @item: the schema type | 2981 * @item: the schema type |
2973 * @itemElem: the node of the schema type | 2982 * @itemElem: the node of the schema type |
2974 * @attr: the invalid schema attribute | 2983 * @attr: the invalid schema attribute |
2975 * @message: the error message | 2984 * @message: the error message |
2976 * @str1: the optional param for the error message | 2985 * @str1: the optional param for the error message |
2977 * | 2986 * |
2978 * Reports an attribute use error during parsing. | 2987 * Reports an attribute use error during parsing. |
2979 */ | 2988 */ |
2980 static void | 2989 static void LIBXML_ATTR_FORMAT(6,0) |
2981 xmlSchemaPAttrUseErr4(xmlSchemaParserCtxtPtr ctxt, | 2990 xmlSchemaPAttrUseErr4(xmlSchemaParserCtxtPtr ctxt, |
2982 xmlParserErrors error, | 2991 xmlParserErrors error, |
2983 xmlNodePtr node, | 2992 xmlNodePtr node, |
2984 xmlSchemaBasicItemPtr ownerItem, | 2993 xmlSchemaBasicItemPtr ownerItem, |
2985 const xmlSchemaAttributeUsePtr attruse, | 2994 const xmlSchemaAttributeUsePtr attruse, |
2986 const char *message, | 2995 const char *message, |
2987 const xmlChar *str1, const xmlChar *str2, | 2996 const xmlChar *str1, const xmlChar *str2, |
2988 const xmlChar *str3,const xmlChar *str4) | 2997 const xmlChar *str3,const xmlChar *str4) |
2989 { | 2998 { |
2990 xmlChar *str = NULL, *msg = NULL; | 2999 xmlChar *str = NULL, *msg = NULL; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3092 * @error: the error code | 3101 * @error: the error code |
3093 * @type: the type specifier | 3102 * @type: the type specifier |
3094 * @ownerDes: the designation of the owner | 3103 * @ownerDes: the designation of the owner |
3095 * @ownerItem: the schema object if existent | 3104 * @ownerItem: the schema object if existent |
3096 * @node: the validated node | 3105 * @node: the validated node |
3097 * @value: the validated value | 3106 * @value: the validated value |
3098 * | 3107 * |
3099 * Reports a simple type validation error. | 3108 * Reports a simple type validation error. |
3100 * TODO: Should this report the value of an element as well? | 3109 * TODO: Should this report the value of an element as well? |
3101 */ | 3110 */ |
3102 static void | 3111 static void LIBXML_ATTR_FORMAT(8,0) |
3103 xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt, | 3112 xmlSchemaPSimpleTypeErr(xmlSchemaParserCtxtPtr ctxt, |
3104 xmlParserErrors error, | 3113 xmlParserErrors error, |
3105 xmlSchemaBasicItemPtr ownerItem ATTRIBUTE_UNUSED, | 3114 xmlSchemaBasicItemPtr ownerItem ATTRIBUTE_UNUSED, |
3106 xmlNodePtr node, | 3115 xmlNodePtr node, |
3107 xmlSchemaTypePtr type, | 3116 xmlSchemaTypePtr type, |
3108 const char *expected, | 3117 const char *expected, |
3109 const xmlChar *value, | 3118 const xmlChar *value, |
3110 const char *message, | 3119 const char *message, |
3111 const xmlChar *str1, | 3120 const xmlChar *str1, |
3112 const xmlChar *str2) | 3121 const xmlChar *str2) |
(...skipping 21 matching lines...) Expand all Loading... |
3134 else if (WXS_IS_LIST(type)) | 3143 else if (WXS_IS_LIST(type)) |
3135 msg = xmlStrcat(msg, BAD_CAST "list type"); | 3144 msg = xmlStrcat(msg, BAD_CAST "list type"); |
3136 else if (WXS_IS_UNION(type)) | 3145 else if (WXS_IS_UNION(type)) |
3137 msg = xmlStrcat(msg, BAD_CAST "union type"); | 3146 msg = xmlStrcat(msg, BAD_CAST "union type"); |
3138 | 3147 |
3139 if (xmlSchemaIsGlobalItem(type)) { | 3148 if (xmlSchemaIsGlobalItem(type)) { |
3140 xmlChar *str = NULL; | 3149 xmlChar *str = NULL; |
3141 msg = xmlStrcat(msg, BAD_CAST " '"); | 3150 msg = xmlStrcat(msg, BAD_CAST " '"); |
3142 if (type->builtInType != 0) { | 3151 if (type->builtInType != 0) { |
3143 msg = xmlStrcat(msg, BAD_CAST "xs:"); | 3152 msg = xmlStrcat(msg, BAD_CAST "xs:"); |
3144 » » msg = xmlStrcat(msg, type->name); | 3153 » » str = xmlStrdup(type->name); |
3145 » » } else | 3154 » » } else { |
3146 » » msg = xmlStrcat(msg, | 3155 » » const xmlChar *qName = xmlSchemaFormatQName(&str, type->targ
etNamespace, type->name); |
3147 » » » xmlSchemaFormatQName(&str, | 3156 » » if (!str) |
3148 » » » type->targetNamespace, type->name)); | 3157 » » » str = xmlStrdup(qName); |
| 3158 » » } |
| 3159 » » msg = xmlStrcat(msg, xmlEscapeFormatString(&str)); |
3149 msg = xmlStrcat(msg, BAD_CAST "'."); | 3160 msg = xmlStrcat(msg, BAD_CAST "'."); |
3150 FREE_AND_NULL(str); | 3161 FREE_AND_NULL(str); |
3151 } | 3162 } |
3152 } else { | 3163 } else { |
3153 if (node->type == XML_ATTRIBUTE_NODE) | 3164 if (node->type == XML_ATTRIBUTE_NODE) |
3154 msg = xmlStrcat(msg, BAD_CAST "The value '%s' is not valid."); | 3165 msg = xmlStrcat(msg, BAD_CAST "The value '%s' is not valid."); |
3155 else | 3166 else |
3156 msg = xmlStrcat(msg, BAD_CAST "The character content is not " | 3167 msg = xmlStrcat(msg, BAD_CAST "The character content is not " |
3157 "valid."); | 3168 "valid."); |
3158 } | 3169 } |
3159 if (expected) { | 3170 if (expected) { |
3160 msg = xmlStrcat(msg, BAD_CAST " Expected is '"); | 3171 msg = xmlStrcat(msg, BAD_CAST " Expected is '"); |
3161 » msg = xmlStrcat(msg, BAD_CAST expected); | 3172 » xmlChar *expectedEscaped = xmlCharStrdup(expected); |
| 3173 » msg = xmlStrcat(msg, xmlEscapeFormatString(&expectedEscaped)); |
| 3174 » FREE_AND_NULL(expectedEscaped); |
3162 msg = xmlStrcat(msg, BAD_CAST "'.\n"); | 3175 msg = xmlStrcat(msg, BAD_CAST "'.\n"); |
3163 } else | 3176 } else |
3164 msg = xmlStrcat(msg, BAD_CAST "\n"); | 3177 msg = xmlStrcat(msg, BAD_CAST "\n"); |
3165 if (node->type == XML_ATTRIBUTE_NODE) | 3178 if (node->type == XML_ATTRIBUTE_NODE) |
3166 xmlSchemaPErr(ctxt, node, error, (const char *) msg, value, NULL); | 3179 xmlSchemaPErr(ctxt, node, error, (const char *) msg, value, NULL); |
3167 else | 3180 else |
3168 xmlSchemaPErr(ctxt, node, error, (const char *) msg, NULL, NULL); | 3181 xmlSchemaPErr(ctxt, node, error, (const char *) msg, NULL, NULL); |
3169 } else { | 3182 } else { |
3170 msg = xmlStrcat(msg, BAD_CAST message); | 3183 msg = xmlStrcat(msg, BAD_CAST message); |
3171 msg = xmlStrcat(msg, BAD_CAST ".\n"); | 3184 msg = xmlStrcat(msg, BAD_CAST ".\n"); |
(...skipping 25733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
28905 xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt) | 28918 xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt) |
28906 { | 28919 { |
28907 if (ctxt == NULL) | 28920 if (ctxt == NULL) |
28908 return(NULL); | 28921 return(NULL); |
28909 return (ctxt->parserCtxt); | 28922 return (ctxt->parserCtxt); |
28910 } | 28923 } |
28911 | 28924 |
28912 #define bottom_xmlschemas | 28925 #define bottom_xmlschemas |
28913 #include "elfgcchack.h" | 28926 #include "elfgcchack.h" |
28914 #endif /* LIBXML_SCHEMAS_ENABLED */ | 28927 #endif /* LIBXML_SCHEMAS_ENABLED */ |
OLD | NEW |