Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/libxml/src/xmlschemas.c

Issue 2414643002: Roll libxml to 3169602058bd2d04913909e869c61d1540bc7fb4 (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libxml/src/win32/VC10/RuleSet1.ruleset ('k') | third_party/libxml/src/xpath.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3150 matching lines...) Expand 10 before | Expand all | Expand 10 after
3161 FREE_AND_NULL(str); 3161 FREE_AND_NULL(str);
3162 } 3162 }
3163 } else { 3163 } else {
3164 if (node->type == XML_ATTRIBUTE_NODE) 3164 if (node->type == XML_ATTRIBUTE_NODE)
3165 msg = xmlStrcat(msg, BAD_CAST "The value '%s' is not valid."); 3165 msg = xmlStrcat(msg, BAD_CAST "The value '%s' is not valid.");
3166 else 3166 else
3167 msg = xmlStrcat(msg, BAD_CAST "The character content is not " 3167 msg = xmlStrcat(msg, BAD_CAST "The character content is not "
3168 "valid."); 3168 "valid.");
3169 } 3169 }
3170 if (expected) { 3170 if (expected) {
3171 xmlChar *expectedEscaped = xmlCharStrdup(expected);
3171 msg = xmlStrcat(msg, BAD_CAST " Expected is '"); 3172 msg = xmlStrcat(msg, BAD_CAST " Expected is '");
3172 xmlChar *expectedEscaped = xmlCharStrdup(expected);
3173 msg = xmlStrcat(msg, xmlEscapeFormatString(&expectedEscaped)); 3173 msg = xmlStrcat(msg, xmlEscapeFormatString(&expectedEscaped));
3174 FREE_AND_NULL(expectedEscaped); 3174 FREE_AND_NULL(expectedEscaped);
3175 msg = xmlStrcat(msg, BAD_CAST "'.\n"); 3175 msg = xmlStrcat(msg, BAD_CAST "'.\n");
3176 } else 3176 } else
3177 msg = xmlStrcat(msg, BAD_CAST "\n"); 3177 msg = xmlStrcat(msg, BAD_CAST "\n");
3178 if (node->type == XML_ATTRIBUTE_NODE) 3178 if (node->type == XML_ATTRIBUTE_NODE)
3179 xmlSchemaPErr(ctxt, node, error, (const char *) msg, value, NULL); 3179 xmlSchemaPErr(ctxt, node, error, (const char *) msg, value, NULL);
3180 else 3180 else
3181 xmlSchemaPErr(ctxt, node, error, (const char *) msg, NULL, NULL); 3181 xmlSchemaPErr(ctxt, node, error, (const char *) msg, NULL, NULL);
3182 } else { 3182 } else {
(...skipping 24201 matching lines...) Expand 10 before | Expand all | Expand 10 after
27384 namespaces[j+1]; 27384 namespaces[j+1];
27385 ielem->nbNsBindings++; 27385 ielem->nbNsBindings++;
27386 } 27386 }
27387 } 27387 }
27388 /* 27388 /*
27389 * Register attributes. 27389 * Register attributes.
27390 * SAX VAL TODO: We are not adding namespace declaration 27390 * SAX VAL TODO: We are not adding namespace declaration
27391 * attributes yet. 27391 * attributes yet.
27392 */ 27392 */
27393 if (nb_attributes != 0) { 27393 if (nb_attributes != 0) {
27394 int valueLen, k, l;
27394 xmlChar *value; 27395 xmlChar *value;
27395 27396
27396 for (j = 0, i = 0; i < nb_attributes; i++, j += 5) { 27397 for (j = 0, i = 0; i < nb_attributes; i++, j += 5) {
27397 /* 27398 /*
27398 * Duplicate the value, changing any &#38; to a literal ampersand. 27399 * Duplicate the value, changing any &#38; to a literal ampersand.
27399 * 27400 *
27400 * libxml2 differs from normal SAX here in that it escapes all ampers ands 27401 * libxml2 differs from normal SAX here in that it escapes all ampers ands
27401 * as &#38; instead of delivering the raw converted string. Changing the 27402 * as &#38; instead of delivering the raw converted string. Changing the
27402 * behavior at this point would break applications that use this API, so 27403 * behavior at this point would break applications that use this API, so
27403 » * we are forced to work around it. There is no danger of accidentall y 27404 » * we are forced to work around it.
27404 » * decoding some entity other than &#38; in this step because without
27405 » * unescaped ampersands there can be no other entities in the string.
27406 */ 27405 */
27407 » value = xmlStringLenDecodeEntities(vctxt->parserCtxt, attributes[j+3 ], 27406 » valueLen = attributes[j+4] - attributes[j+3];
27408 » » attributes[j+4] - attributes[j+3], XML_SUBSTITUTE_REF, 0, 0, 0); 27407 » value = xmlMallocAtomic(valueLen + 1);
27408 » if (value == NULL) {
27409 » » xmlSchemaVErrMemory(vctxt,
27410 » » "allocating string for decoded attribute",
27411 » » NULL);
27412 » » goto internal_error;
27413 » }
27414 » for (k = 0, l = 0; k < valueLen; l++) {
27415 » » if (k < valueLen - 4 &&
27416 » » attributes[j+3][k+0] == '&' &&
27417 » » attributes[j+3][k+1] == '#' &&
27418 » » attributes[j+3][k+2] == '3' &&
27419 » » attributes[j+3][k+3] == '8' &&
27420 » » attributes[j+3][k+4] == ';') {
27421 » » value[l] = '&';
27422 » » k += 5;
27423 » » } else {
27424 » » value[l] = attributes[j+3][k];
27425 » » k++;
27426 » » }
27427 » }
27428 » value[l] = '\0';
27409 /* 27429 /*
27410 * TODO: Set the node line. 27430 * TODO: Set the node line.
27411 */ 27431 */
27412 ret = xmlSchemaValidatorPushAttribute(vctxt, 27432 ret = xmlSchemaValidatorPushAttribute(vctxt,
27413 NULL, ielem->nodeLine, attributes[j], attributes[j+2], 0, 27433 NULL, ielem->nodeLine, attributes[j], attributes[j+2], 0,
27414 value, 1); 27434 value, 1);
27415 if (ret == -1) { 27435 if (ret == -1) {
27416 VERROR_INT("xmlSchemaSAXHandleStartElementNs", 27436 VERROR_INT("xmlSchemaSAXHandleStartElementNs",
27417 "calling xmlSchemaValidatorPushAttribute()"); 27437 "calling xmlSchemaValidatorPushAttribute()");
27418 goto internal_error; 27438 goto internal_error;
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after
28918 xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt) 28938 xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt)
28919 { 28939 {
28920 if (ctxt == NULL) 28940 if (ctxt == NULL)
28921 return(NULL); 28941 return(NULL);
28922 return (ctxt->parserCtxt); 28942 return (ctxt->parserCtxt);
28923 } 28943 }
28924 28944
28925 #define bottom_xmlschemas 28945 #define bottom_xmlschemas
28926 #include "elfgcchack.h" 28946 #include "elfgcchack.h"
28927 #endif /* LIBXML_SCHEMAS_ENABLED */ 28947 #endif /* LIBXML_SCHEMAS_ENABLED */
OLDNEW
« no previous file with comments | « third_party/libxml/src/win32/VC10/RuleSet1.ruleset ('k') | third_party/libxml/src/xpath.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698