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

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

Issue 1193533007: Upgrade to libxml 2.9.2 and libxslt 1.1.28 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no iconv Created 5 years, 6 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/SAX.c ('k') | third_party/libxml/src/acconfig.h » ('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 * SAX2.c : Default SAX2 handler to build a tree. 2 * SAX2.c : Default SAX2 handler to build a tree.
3 * 3 *
4 * See Copyright for the status of this software. 4 * See Copyright for the status of this software.
5 * 5 *
6 * Daniel Veillard <daniel@veillard.com> 6 * Daniel Veillard <daniel@veillard.com>
7 */ 7 */
8 8
9 9
10 #define IN_LIBXML 10 #define IN_LIBXML
(...skipping 27 matching lines...) Expand all
38 /** 38 /**
39 * TODO: 39 * TODO:
40 * 40 *
41 * macro to flag unimplemented blocks 41 * macro to flag unimplemented blocks
42 * XML_CATALOG_PREFER user env to select between system/public prefered 42 * XML_CATALOG_PREFER user env to select between system/public prefered
43 * option. C.f. Richard Tobin <richard@cogsci.ed.ac.uk> 43 * option. C.f. Richard Tobin <richard@cogsci.ed.ac.uk>
44 *> Just FYI, I am using an environment variable XML_CATALOG_PREFER with 44 *> Just FYI, I am using an environment variable XML_CATALOG_PREFER with
45 *> values "system" and "public". I have made the default be "system" to 45 *> values "system" and "public". I have made the default be "system" to
46 *> match yours. 46 *> match yours.
47 */ 47 */
48 #define TODO » » » » » » » » \ 48 #define TODO» » » » » » » » \
49 xmlGenericError(xmlGenericErrorContext, \ 49 xmlGenericError(xmlGenericErrorContext, \
50 "Unimplemented block at %s:%d\n", \ 50 "Unimplemented block at %s:%d\n", \
51 __FILE__, __LINE__); 51 __FILE__, __LINE__);
52 52
53 /* 53 /*
54 * xmlSAX2ErrMemory: 54 * xmlSAX2ErrMemory:
55 * @ctxt: an XML validation parser context 55 * @ctxt: an XML validation parser context
56 * @msg: a string to accompany the error message 56 * @msg: a string to accompany the error message
57 */ 57 */
58 static void 58 static void
59 xmlSAX2ErrMemory(xmlParserCtxtPtr ctxt, const char *msg) { 59 xmlSAX2ErrMemory(xmlParserCtxtPtr ctxt, const char *msg) {
60 xmlStructuredErrorFunc schannel = NULL;
61 const char *str1 = "out of memory\n";
62
60 if (ctxt != NULL) { 63 if (ctxt != NULL) {
61 » if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) 64 » ctxt->errNo = XML_ERR_NO_MEMORY;
62 » ctxt->sax->error(ctxt->userData, "%s: out of memory\n", msg); 65 » if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC))
66 » schannel = ctxt->sax->serror;
67 » __xmlRaiseError(schannel,
68 » » » ctxt->vctxt.error, ctxt->vctxt.userData,
69 » » » ctxt, NULL, XML_FROM_PARSER, XML_ERR_NO_MEMORY,
70 » » » XML_ERR_ERROR, NULL, 0, (const char *) str1,
71 » » » NULL, NULL, 0, 0,
72 » » » msg, (const char *) str1, NULL);
63 ctxt->errNo = XML_ERR_NO_MEMORY; 73 ctxt->errNo = XML_ERR_NO_MEMORY;
64 ctxt->instate = XML_PARSER_EOF; 74 ctxt->instate = XML_PARSER_EOF;
65 ctxt->disableSAX = 1; 75 ctxt->disableSAX = 1;
76 } else {
77 __xmlRaiseError(schannel,
78 NULL, NULL,
79 ctxt, NULL, XML_FROM_PARSER, XML_ERR_NO_MEMORY,
80 XML_ERR_ERROR, NULL, 0, (const char *) str1,
81 NULL, NULL, 0, 0,
82 msg, (const char *) str1, NULL);
66 } 83 }
67 } 84 }
68 85
69 /** 86 /**
70 * xmlValidError: 87 * xmlValidError:
71 * @ctxt: an XML validation parser context 88 * @ctxt: an XML validation parser context
72 * @error: the error number 89 * @error: the error number
73 * @msg: the error message 90 * @msg: the error message
74 * @str1: extra data 91 * @str1: extra data
75 * @str2: extra data 92 * @str2: extra data
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 static void 136 static void
120 xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, 137 xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
121 const char *msg, const xmlChar *str1, const xmlChar *str2) 138 const char *msg, const xmlChar *str1, const xmlChar *str2)
122 { 139 {
123 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && 140 if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
124 (ctxt->instate == XML_PARSER_EOF)) 141 (ctxt->instate == XML_PARSER_EOF))
125 return; 142 return;
126 if (ctxt != NULL) 143 if (ctxt != NULL)
127 ctxt->errNo = error; 144 ctxt->errNo = error;
128 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, 145 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error,
129 XML_ERR_FATAL, NULL, 0, 146 XML_ERR_FATAL, NULL, 0,
130 (const char *) str1, (const char *) str2, 147 (const char *) str1, (const char *) str2,
131 NULL, 0, 0, msg, str1, str2); 148 NULL, 0, 0, msg, str1, str2);
132 if (ctxt != NULL) { 149 if (ctxt != NULL) {
133 ctxt->wellFormed = 0; 150 ctxt->wellFormed = 0;
134 ctxt->valid = 0; 151 ctxt->valid = 0;
135 if (ctxt->recovery == 0) 152 if (ctxt->recovery == 0)
136 ctxt->disableSAX = 1; 153 ctxt->disableSAX = 1;
137 } 154 }
138 } 155 }
139 156
(...skipping 10 matching lines...) Expand all
150 static void 167 static void
151 xmlWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, 168 xmlWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
152 const char *msg, const xmlChar *str1) 169 const char *msg, const xmlChar *str1)
153 { 170 {
154 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && 171 if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
155 (ctxt->instate == XML_PARSER_EOF)) 172 (ctxt->instate == XML_PARSER_EOF))
156 return; 173 return;
157 if (ctxt != NULL) 174 if (ctxt != NULL)
158 ctxt->errNo = error; 175 ctxt->errNo = error;
159 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, 176 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error,
160 XML_ERR_WARNING, NULL, 0, 177 XML_ERR_WARNING, NULL, 0,
161 (const char *) str1, NULL, 178 (const char *) str1, NULL,
162 NULL, 0, 0, msg, str1); 179 NULL, 0, 0, msg, str1);
163 } 180 }
164 181
165 /** 182 /**
166 * xmlNsErrMsg: 183 * xmlNsErrMsg:
167 * @ctxt: an XML parser context 184 * @ctxt: an XML parser context
168 * @error: the error number 185 * @error: the error number
169 * @msg: the error message 186 * @msg: the error message
170 * @str1: an error string 187 * @str1: an error string
171 * @str2: an error string 188 * @str2: an error string
172 * 189 *
173 * Handle a namespace error 190 * Handle a namespace error
174 */ 191 */
175 static void 192 static void
176 xmlNsErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, 193 xmlNsErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
177 const char *msg, const xmlChar *str1, const xmlChar *str2) 194 const char *msg, const xmlChar *str1, const xmlChar *str2)
178 { 195 {
179 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && 196 if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
180 (ctxt->instate == XML_PARSER_EOF)) 197 (ctxt->instate == XML_PARSER_EOF))
181 return; 198 return;
182 if (ctxt != NULL) 199 if (ctxt != NULL)
183 ctxt->errNo = error; 200 ctxt->errNo = error;
184 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, 201 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error,
185 XML_ERR_ERROR, NULL, 0, 202 XML_ERR_ERROR, NULL, 0,
186 (const char *) str1, (const char *) str2, 203 (const char *) str1, (const char *) str2,
187 NULL, 0, 0, msg, str1, str2); 204 NULL, 0, 0, msg, str1, str2);
188 } 205 }
189 206
190 /** 207 /**
191 * xmlNsWarnMsg: 208 * xmlNsWarnMsg:
192 * @ctxt: an XML parser context 209 * @ctxt: an XML parser context
193 * @error: the error number 210 * @error: the error number
194 * @msg: the error message 211 * @msg: the error message
195 * @str1: an error string 212 * @str1: an error string
196 * 213 *
197 * Handle a namespace warning 214 * Handle a namespace warning
198 */ 215 */
199 static void 216 static void
200 xmlNsWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, 217 xmlNsWarnMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error,
201 const char *msg, const xmlChar *str1, const xmlChar *str2) 218 const char *msg, const xmlChar *str1, const xmlChar *str2)
202 { 219 {
203 if ((ctxt != NULL) && (ctxt->disableSAX != 0) && 220 if ((ctxt != NULL) && (ctxt->disableSAX != 0) &&
204 (ctxt->instate == XML_PARSER_EOF)) 221 (ctxt->instate == XML_PARSER_EOF))
205 return; 222 return;
206 if (ctxt != NULL) 223 if (ctxt != NULL)
207 ctxt->errNo = error; 224 ctxt->errNo = error;
208 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error, 225 __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_NAMESPACE, error,
209 XML_ERR_WARNING, NULL, 0, 226 XML_ERR_WARNING, NULL, 0,
210 (const char *) str1, (const char *) str2, 227 (const char *) str1, (const char *) str2,
211 NULL, 0, 0, msg, str1, str2); 228 NULL, 0, 0, msg, str1, str2);
212 } 229 }
213 230
214 /** 231 /**
215 * xmlSAX2GetPublicId: 232 * xmlSAX2GetPublicId:
216 * @ctx: the user data (XML parser context) 233 * @ctx: the user data (XML parser context)
217 * 234 *
218 * Provides the public ID e.g. "-//SGMLSOURCE//DTD DEMO//EN" 235 * Provides the public ID e.g. "-//SGMLSOURCE//DTD DEMO//EN"
219 * 236 *
(...skipping 13 matching lines...) Expand all
233 * Provides the system ID, basically URL or filename e.g. 250 * Provides the system ID, basically URL or filename e.g.
234 * http://www.sgmlsource.com/dtds/memo.dtd 251 * http://www.sgmlsource.com/dtds/memo.dtd
235 * 252 *
236 * Returns a xmlChar * 253 * Returns a xmlChar *
237 */ 254 */
238 const xmlChar * 255 const xmlChar *
239 xmlSAX2GetSystemId(void *ctx) 256 xmlSAX2GetSystemId(void *ctx)
240 { 257 {
241 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; 258 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
242 if ((ctx == NULL) || (ctxt->input == NULL)) return(NULL); 259 if ((ctx == NULL) || (ctxt->input == NULL)) return(NULL);
243 return((const xmlChar *) ctxt->input->filename); 260 return((const xmlChar *) ctxt->input->filename);
244 } 261 }
245 262
246 /** 263 /**
247 * xmlSAX2GetLineNumber: 264 * xmlSAX2GetLineNumber:
248 * @ctx: the user data (XML parser context) 265 * @ctx: the user data (XML parser context)
249 * 266 *
250 * Provide the line number of the current parsing point. 267 * Provide the line number of the current parsing point.
251 * 268 *
252 * Returns an int 269 * Returns an int
253 */ 270 */
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 if (ctxt->myDoc == NULL) 365 if (ctxt->myDoc == NULL)
349 return; 366 return;
350 dtd = xmlGetIntSubset(ctxt->myDoc); 367 dtd = xmlGetIntSubset(ctxt->myDoc);
351 if (dtd != NULL) { 368 if (dtd != NULL) {
352 if (ctxt->html) 369 if (ctxt->html)
353 return; 370 return;
354 xmlUnlinkNode((xmlNodePtr) dtd); 371 xmlUnlinkNode((xmlNodePtr) dtd);
355 xmlFreeDtd(dtd); 372 xmlFreeDtd(dtd);
356 ctxt->myDoc->intSubset = NULL; 373 ctxt->myDoc->intSubset = NULL;
357 } 374 }
358 ctxt->myDoc->intSubset = 375 ctxt->myDoc->intSubset =
359 xmlCreateIntSubset(ctxt->myDoc, name, ExternalID, SystemID); 376 xmlCreateIntSubset(ctxt->myDoc, name, ExternalID, SystemID);
360 if (ctxt->myDoc->intSubset == NULL) 377 if (ctxt->myDoc->intSubset == NULL)
361 xmlSAX2ErrMemory(ctxt, "xmlSAX2InternalSubset"); 378 xmlSAX2ErrMemory(ctxt, "xmlSAX2InternalSubset");
362 } 379 }
363 380
364 /** 381 /**
365 * xmlSAX2ExternalSubset: 382 * xmlSAX2ExternalSubset:
366 * @ctx: the user data (XML parser context) 383 * @ctx: the user data (XML parser context)
367 * @name: the root element name 384 * @name: the root element name
368 * @ExternalID: the external ID 385 * @ExternalID: the external ID
(...skipping 18 matching lines...) Expand all
387 /* 404 /*
388 * Try to fetch and parse the external subset. 405 * Try to fetch and parse the external subset.
389 */ 406 */
390 xmlParserInputPtr oldinput; 407 xmlParserInputPtr oldinput;
391 int oldinputNr; 408 int oldinputNr;
392 int oldinputMax; 409 int oldinputMax;
393 xmlParserInputPtr *oldinputTab; 410 xmlParserInputPtr *oldinputTab;
394 xmlParserInputPtr input = NULL; 411 xmlParserInputPtr input = NULL;
395 xmlCharEncoding enc; 412 xmlCharEncoding enc;
396 int oldcharset; 413 int oldcharset;
414 const xmlChar *oldencoding;
397 415
398 /* 416 /*
399 * Ask the Entity resolver to load the damn thing 417 * Ask the Entity resolver to load the damn thing
400 */ 418 */
401 if ((ctxt->sax != NULL) && (ctxt->sax->resolveEntity != NULL)) 419 if ((ctxt->sax != NULL) && (ctxt->sax->resolveEntity != NULL))
402 input = ctxt->sax->resolveEntity(ctxt->userData, ExternalID, 420 input = ctxt->sax->resolveEntity(ctxt->userData, ExternalID,
403 SystemID); 421 SystemID);
404 if (input == NULL) { 422 if (input == NULL) {
405 return; 423 return;
406 } 424 }
407 425
408 xmlNewDtd(ctxt->myDoc, name, ExternalID, SystemID); 426 xmlNewDtd(ctxt->myDoc, name, ExternalID, SystemID);
409 427
410 /* 428 /*
411 * make sure we won't destroy the main document context 429 * make sure we won't destroy the main document context
412 */ 430 */
413 oldinput = ctxt->input; 431 oldinput = ctxt->input;
414 oldinputNr = ctxt->inputNr; 432 oldinputNr = ctxt->inputNr;
415 oldinputMax = ctxt->inputMax; 433 oldinputMax = ctxt->inputMax;
416 oldinputTab = ctxt->inputTab; 434 oldinputTab = ctxt->inputTab;
417 oldcharset = ctxt->charset; 435 oldcharset = ctxt->charset;
436 oldencoding = ctxt->encoding;
437 ctxt->encoding = NULL;
418 438
419 ctxt->inputTab = (xmlParserInputPtr *) 439 ctxt->inputTab = (xmlParserInputPtr *)
420 xmlMalloc(5 * sizeof(xmlParserInputPtr)); 440 xmlMalloc(5 * sizeof(xmlParserInputPtr));
421 if (ctxt->inputTab == NULL) { 441 if (ctxt->inputTab == NULL) {
422 xmlSAX2ErrMemory(ctxt, "xmlSAX2ExternalSubset"); 442 xmlSAX2ErrMemory(ctxt, "xmlSAX2ExternalSubset");
423 ctxt->input = oldinput; 443 ctxt->input = oldinput;
424 ctxt->inputNr = oldinputNr; 444 ctxt->inputNr = oldinputNr;
425 ctxt->inputMax = oldinputMax; 445 ctxt->inputMax = oldinputMax;
426 ctxt->inputTab = oldinputTab; 446 ctxt->inputTab = oldinputTab;
427 ctxt->charset = oldcharset; 447 ctxt->charset = oldcharset;
448 ctxt->encoding = oldencoding;
428 return; 449 return;
429 } 450 }
430 ctxt->inputNr = 0; 451 ctxt->inputNr = 0;
431 ctxt->inputMax = 5; 452 ctxt->inputMax = 5;
432 ctxt->input = NULL; 453 ctxt->input = NULL;
433 xmlPushInput(ctxt, input); 454 xmlPushInput(ctxt, input);
434 455
435 /* 456 /*
436 * On the fly encoding conversion if needed 457 * On the fly encoding conversion if needed
437 */ 458 */
(...skipping 25 matching lines...) Expand all
463 xmlFree(ctxt->inputTab); 484 xmlFree(ctxt->inputTab);
464 485
465 /* 486 /*
466 * Restore the parsing context of the main entity 487 * Restore the parsing context of the main entity
467 */ 488 */
468 ctxt->input = oldinput; 489 ctxt->input = oldinput;
469 ctxt->inputNr = oldinputNr; 490 ctxt->inputNr = oldinputNr;
470 ctxt->inputMax = oldinputMax; 491 ctxt->inputMax = oldinputMax;
471 ctxt->inputTab = oldinputTab; 492 ctxt->inputTab = oldinputTab;
472 ctxt->charset = oldcharset; 493 ctxt->charset = oldcharset;
494 if ((ctxt->encoding != NULL) &&
495 ((ctxt->dict == NULL) ||
496 (!xmlDictOwns(ctxt->dict, ctxt->encoding))))
497 xmlFree((xmlChar *) ctxt->encoding);
498 ctxt->encoding = oldencoding;
473 /* ctxt->wellFormed = oldwellFormed; */ 499 /* ctxt->wellFormed = oldwellFormed; */
474 } 500 }
475 } 501 }
476 502
477 /** 503 /**
478 * xmlSAX2ResolveEntity: 504 * xmlSAX2ResolveEntity:
479 * @ctx: the user data (XML parser context) 505 * @ctx: the user data (XML parser context)
480 * @publicId: The public ID of the entity 506 * @publicId: The public ID of the entity
481 * @systemId: The system ID of the entity 507 * @systemId: The system ID of the entity
482 * 508 *
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 ((ctxt->validate) || (ctxt->replaceEntities)) && 593 ((ctxt->validate) || (ctxt->replaceEntities)) &&
568 (ret->children == NULL) && 594 (ret->children == NULL) &&
569 (ret->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) { 595 (ret->etype == XML_EXTERNAL_GENERAL_PARSED_ENTITY)) {
570 int val; 596 int val;
571 597
572 /* 598 /*
573 * for validation purposes we really need to fetch and 599 * for validation purposes we really need to fetch and
574 * parse the external entity 600 * parse the external entity
575 */ 601 */
576 xmlNodePtr children; 602 xmlNodePtr children;
603 unsigned long oldnbent = ctxt->nbentities;
577 604
578 val = xmlParseCtxtExternalEntity(ctxt, ret->URI, 605 val = xmlParseCtxtExternalEntity(ctxt, ret->URI,
579 ret->ExternalID, &children); 606 ret->ExternalID, &children);
580 if (val == 0) { 607 if (val == 0) {
581 xmlAddChildList((xmlNodePtr) ret, children); 608 xmlAddChildList((xmlNodePtr) ret, children);
582 } else { 609 } else {
583 xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_PROCESSING, 610 xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_PROCESSING,
584 "Failure to process entity %s\n", name, NULL); 611 "Failure to process entity %s\n", name, NULL);
585 ctxt->validate = 0; 612 ctxt->validate = 0;
586 return(NULL); 613 return(NULL);
587 } 614 }
588 ret->owner = 1; 615 ret->owner = 1;
589 » if (ret->checked == 0) 616 » if (ret->checked == 0) {
590 » ret->checked = 1; 617 » ret->checked = (ctxt->nbentities - oldnbent + 1) * 2;
618 » if ((ret->content != NULL) && (xmlStrchr(ret->content, '<')))
619 » ret->checked |= 1;
620 » }
591 } 621 }
592 return(ret); 622 return(ret);
593 } 623 }
594 624
595 /** 625 /**
596 * xmlSAX2GetParameterEntity: 626 * xmlSAX2GetParameterEntity:
597 * @ctx: the user data (XML parser context) 627 * @ctx: the user data (XML parser context)
598 * @name: The entity name 628 * @name: The entity name
599 * 629 *
600 * Get a parameter entity by name 630 * Get a parameter entity by name
(...skipping 13 matching lines...) Expand all
614 #endif 644 #endif
615 645
616 ret = xmlGetParameterEntity(ctxt->myDoc, name); 646 ret = xmlGetParameterEntity(ctxt->myDoc, name);
617 return(ret); 647 return(ret);
618 } 648 }
619 649
620 650
621 /** 651 /**
622 * xmlSAX2EntityDecl: 652 * xmlSAX2EntityDecl:
623 * @ctx: the user data (XML parser context) 653 * @ctx: the user data (XML parser context)
624 * @name: the entity name 654 * @name: the entity name
625 * @type: the entity type 655 * @type: the entity type
626 * @publicId: The public ID of the entity 656 * @publicId: The public ID of the entity
627 * @systemId: The system ID of the entity 657 * @systemId: The system ID of the entity
628 * @content: the entity value (without processing). 658 * @content: the entity value (without processing).
629 * 659 *
630 * An entity definition has been parsed 660 * An entity definition has been parsed
631 */ 661 */
632 void 662 void
633 xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type, 663 xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type,
634 const xmlChar *publicId, const xmlChar *systemId, xmlChar *content) 664 const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
635 { 665 {
(...skipping 14 matching lines...) Expand all
650 "Entity(%s) already defined in the internal subset\n", 680 "Entity(%s) already defined in the internal subset\n",
651 name); 681 name);
652 if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) { 682 if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
653 xmlChar *URI; 683 xmlChar *URI;
654 const char *base = NULL; 684 const char *base = NULL;
655 685
656 if (ctxt->input != NULL) 686 if (ctxt->input != NULL)
657 base = ctxt->input->filename; 687 base = ctxt->input->filename;
658 if (base == NULL) 688 if (base == NULL)
659 base = ctxt->directory; 689 base = ctxt->directory;
660 » 690
661 URI = xmlBuildURI(systemId, (const xmlChar *) base); 691 URI = xmlBuildURI(systemId, (const xmlChar *) base);
662 ent->URI = URI; 692 ent->URI = URI;
663 } 693 }
664 } else if (ctxt->inSubset == 2) { 694 } else if (ctxt->inSubset == 2) {
665 ent = xmlAddDtdEntity(ctxt->myDoc, name, type, publicId, 695 ent = xmlAddDtdEntity(ctxt->myDoc, name, type, publicId,
666 systemId, content); 696 systemId, content);
667 if ((ent == NULL) && (ctxt->pedantic) && 697 if ((ent == NULL) && (ctxt->pedantic) &&
668 (ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) 698 (ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
669 » ctxt->sax->warning(ctxt->userData, 699 » ctxt->sax->warning(ctxt->userData,
670 "Entity(%s) already defined in the external subset\n", name); 700 "Entity(%s) already defined in the external subset\n", name);
671 if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) { 701 if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
672 xmlChar *URI; 702 xmlChar *URI;
673 const char *base = NULL; 703 const char *base = NULL;
674 704
675 if (ctxt->input != NULL) 705 if (ctxt->input != NULL)
676 base = ctxt->input->filename; 706 base = ctxt->input->filename;
677 if (base == NULL) 707 if (base == NULL)
678 base = ctxt->directory; 708 base = ctxt->directory;
679 » 709
680 URI = xmlBuildURI(systemId, (const xmlChar *) base); 710 URI = xmlBuildURI(systemId, (const xmlChar *) base);
681 ent->URI = URI; 711 ent->URI = URI;
682 } 712 }
683 } else { 713 } else {
684 xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_PROCESSING, 714 xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_PROCESSING,
685 "SAX.xmlSAX2EntityDecl(%s) called while not in subset\n", 715 "SAX.xmlSAX2EntityDecl(%s) called while not in subset\n",
686 name, NULL); 716 name, NULL);
687 } 717 }
688 } 718 }
689 719
690 /** 720 /**
691 * xmlSAX2AttributeDecl: 721 * xmlSAX2AttributeDecl:
692 * @ctx: the user data (XML parser context) 722 * @ctx: the user data (XML parser context)
693 * @elem: the name of the element 723 * @elem: the name of the element
694 * @fullname: the attribute name 724 * @fullname: the attribute name
695 * @type: the attribute type 725 * @type: the attribute type
696 * @def: the type of default value 726 * @def: the type of default value
697 * @defaultValue: the attribute default value 727 * @defaultValue: the attribute default value
698 * @tree: the tree of enumerated value set 728 * @tree: the tree of enumerated value set
699 * 729 *
700 * An attribute definition has been parsed 730 * An attribute definition has been parsed
701 */ 731 */
702 void 732 void
703 xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname, 733 xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname,
704 int type, int def, const xmlChar *defaultValue, 734 int type, int def, const xmlChar *defaultValue,
705 xmlEnumerationPtr tree) 735 xmlEnumerationPtr tree)
(...skipping 22 matching lines...) Expand all
728 } 758 }
729 /* TODO: optimize name/prefix allocation */ 759 /* TODO: optimize name/prefix allocation */
730 name = xmlSplitQName(ctxt, fullname, &prefix); 760 name = xmlSplitQName(ctxt, fullname, &prefix);
731 ctxt->vctxt.valid = 1; 761 ctxt->vctxt.valid = 1;
732 if (ctxt->inSubset == 1) 762 if (ctxt->inSubset == 1)
733 attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, elem, 763 attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->intSubset, elem,
734 name, prefix, (xmlAttributeType) type, 764 name, prefix, (xmlAttributeType) type,
735 (xmlAttributeDefault) def, defaultValue, tree); 765 (xmlAttributeDefault) def, defaultValue, tree);
736 else if (ctxt->inSubset == 2) 766 else if (ctxt->inSubset == 2)
737 attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, elem, 767 attr = xmlAddAttributeDecl(&ctxt->vctxt, ctxt->myDoc->extSubset, elem,
738 » name, prefix, (xmlAttributeType) type, 768 » name, prefix, (xmlAttributeType) type,
739 (xmlAttributeDefault) def, defaultValue, tree); 769 (xmlAttributeDefault) def, defaultValue, tree);
740 else { 770 else {
741 xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, 771 xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR,
742 "SAX.xmlSAX2AttributeDecl(%s) called while not in subset\n", 772 "SAX.xmlSAX2AttributeDecl(%s) called while not in subset\n",
743 name, NULL); 773 name, NULL);
744 xmlFreeEnumeration(tree); 774 xmlFreeEnumeration(tree);
745 return; 775 return;
746 } 776 }
747 #ifdef LIBXML_VALID_ENABLED 777 #ifdef LIBXML_VALID_ENABLED
748 if (ctxt->vctxt.valid == 0) 778 if (ctxt->vctxt.valid == 0)
749 ctxt->valid = 0; 779 ctxt->valid = 0;
750 if ((attr != NULL) && (ctxt->validate) && (ctxt->wellFormed) && 780 if ((attr != NULL) && (ctxt->validate) && (ctxt->wellFormed) &&
751 (ctxt->myDoc->intSubset != NULL)) 781 (ctxt->myDoc->intSubset != NULL))
752 ctxt->valid &= xmlValidateAttributeDecl(&ctxt->vctxt, ctxt->myDoc, 782 ctxt->valid &= xmlValidateAttributeDecl(&ctxt->vctxt, ctxt->myDoc,
753 attr); 783 attr);
754 #endif /* LIBXML_VALID_ENABLED */ 784 #endif /* LIBXML_VALID_ENABLED */
755 if (prefix != NULL) 785 if (prefix != NULL)
756 xmlFree(prefix); 786 xmlFree(prefix);
757 if (name != NULL) 787 if (name != NULL)
758 xmlFree(name); 788 xmlFree(name);
759 } 789 }
760 790
761 /** 791 /**
762 * xmlSAX2ElementDecl: 792 * xmlSAX2ElementDecl:
763 * @ctx: the user data (XML parser context) 793 * @ctx: the user data (XML parser context)
764 * @name: the element name 794 * @name: the element name
765 * @type: the element type 795 * @type: the element type
766 * @content: the element value tree 796 * @content: the element value tree
767 * 797 *
768 * An element definition has been parsed 798 * An element definition has been parsed
769 */ 799 */
770 void 800 void
771 xmlSAX2ElementDecl(void *ctx, const xmlChar * name, int type, 801 xmlSAX2ElementDecl(void *ctx, const xmlChar * name, int type,
772 xmlElementContentPtr content) 802 xmlElementContentPtr content)
773 { 803 {
774 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; 804 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
775 xmlElementPtr elem = NULL; 805 xmlElementPtr elem = NULL;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 xmlGenericError(xmlGenericErrorContext, 906 xmlGenericError(xmlGenericErrorContext,
877 "SAX.xmlSAX2UnparsedEntityDecl(%s, %s, %s, %s)\n", 907 "SAX.xmlSAX2UnparsedEntityDecl(%s, %s, %s, %s)\n",
878 name, publicId, systemId, notationName); 908 name, publicId, systemId, notationName);
879 #endif 909 #endif
880 if (ctxt->inSubset == 1) { 910 if (ctxt->inSubset == 1) {
881 ent = xmlAddDocEntity(ctxt->myDoc, name, 911 ent = xmlAddDocEntity(ctxt->myDoc, name,
882 XML_EXTERNAL_GENERAL_UNPARSED_ENTITY, 912 XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
883 publicId, systemId, notationName); 913 publicId, systemId, notationName);
884 if ((ent == NULL) && (ctxt->pedantic) && 914 if ((ent == NULL) && (ctxt->pedantic) &&
885 (ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) 915 (ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
886 » ctxt->sax->warning(ctxt->userData, 916 » ctxt->sax->warning(ctxt->userData,
887 "Entity(%s) already defined in the internal subset\n", name); 917 "Entity(%s) already defined in the internal subset\n", name);
888 if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) { 918 if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
889 xmlChar *URI; 919 xmlChar *URI;
890 const char *base = NULL; 920 const char *base = NULL;
891 921
892 if (ctxt->input != NULL) 922 if (ctxt->input != NULL)
893 base = ctxt->input->filename; 923 base = ctxt->input->filename;
894 if (base == NULL) 924 if (base == NULL)
895 base = ctxt->directory; 925 base = ctxt->directory;
896 » 926
897 URI = xmlBuildURI(systemId, (const xmlChar *) base); 927 URI = xmlBuildURI(systemId, (const xmlChar *) base);
898 ent->URI = URI; 928 ent->URI = URI;
899 } 929 }
900 } else if (ctxt->inSubset == 2) { 930 } else if (ctxt->inSubset == 2) {
901 ent = xmlAddDtdEntity(ctxt->myDoc, name, 931 ent = xmlAddDtdEntity(ctxt->myDoc, name,
902 XML_EXTERNAL_GENERAL_UNPARSED_ENTITY, 932 XML_EXTERNAL_GENERAL_UNPARSED_ENTITY,
903 publicId, systemId, notationName); 933 publicId, systemId, notationName);
904 if ((ent == NULL) && (ctxt->pedantic) && 934 if ((ent == NULL) && (ctxt->pedantic) &&
905 (ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) 935 (ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
906 » ctxt->sax->warning(ctxt->userData, 936 » ctxt->sax->warning(ctxt->userData,
907 "Entity(%s) already defined in the external subset\n", name); 937 "Entity(%s) already defined in the external subset\n", name);
908 if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) { 938 if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
909 xmlChar *URI; 939 xmlChar *URI;
910 const char *base = NULL; 940 const char *base = NULL;
911 941
912 if (ctxt->input != NULL) 942 if (ctxt->input != NULL)
913 base = ctxt->input->filename; 943 base = ctxt->input->filename;
914 if (base == NULL) 944 if (base == NULL)
915 base = ctxt->directory; 945 base = ctxt->directory;
916 » 946
917 URI = xmlBuildURI(systemId, (const xmlChar *) base); 947 URI = xmlBuildURI(systemId, (const xmlChar *) base);
918 ent->URI = URI; 948 ent->URI = URI;
919 } 949 }
920 } else { 950 } else {
921 xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR, 951 xmlFatalErrMsg(ctxt, XML_ERR_INTERNAL_ERROR,
922 "SAX.xmlSAX2UnparsedEntityDecl(%s) called while not in subset\n", 952 "SAX.xmlSAX2UnparsedEntityDecl(%s) called while not in subset\n",
923 name, NULL); 953 name, NULL);
924 } 954 }
925 } 955 }
926 956
(...skipping 30 matching lines...) Expand all
957 if (ctx == NULL) return; 987 if (ctx == NULL) return;
958 988
959 #ifdef DEBUG_SAX 989 #ifdef DEBUG_SAX
960 xmlGenericError(xmlGenericErrorContext, 990 xmlGenericError(xmlGenericErrorContext,
961 "SAX.xmlSAX2StartDocument()\n"); 991 "SAX.xmlSAX2StartDocument()\n");
962 #endif 992 #endif
963 if (ctxt->html) { 993 if (ctxt->html) {
964 #ifdef LIBXML_HTML_ENABLED 994 #ifdef LIBXML_HTML_ENABLED
965 if (ctxt->myDoc == NULL) 995 if (ctxt->myDoc == NULL)
966 ctxt->myDoc = htmlNewDocNoDtD(NULL, NULL); 996 ctxt->myDoc = htmlNewDocNoDtD(NULL, NULL);
967 ctxt->myDoc->properties = XML_DOC_HTML;
968 ctxt->myDoc->parseFlags = ctxt->options;
969 if (ctxt->myDoc == NULL) { 997 if (ctxt->myDoc == NULL) {
970 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument"); 998 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument");
971 return; 999 return;
972 } 1000 }
1001 ctxt->myDoc->properties = XML_DOC_HTML;
1002 ctxt->myDoc->parseFlags = ctxt->options;
973 #else 1003 #else
974 xmlGenericError(xmlGenericErrorContext, 1004 xmlGenericError(xmlGenericErrorContext,
975 "libxml2 built without HTML support\n"); 1005 "libxml2 built without HTML support\n");
976 ctxt->errNo = XML_ERR_INTERNAL_ERROR; 1006 ctxt->errNo = XML_ERR_INTERNAL_ERROR;
977 ctxt->instate = XML_PARSER_EOF; 1007 ctxt->instate = XML_PARSER_EOF;
978 ctxt->disableSAX = 1; 1008 ctxt->disableSAX = 1;
979 return; 1009 return;
980 #endif 1010 #endif
981 } else { 1011 } else {
982 doc = ctxt->myDoc = xmlNewDoc(ctxt->version); 1012 doc = ctxt->myDoc = xmlNewDoc(ctxt->version);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 (ctxt->inputTab[0]->encoding != NULL) && (ctxt->myDoc != NULL) && 1071 (ctxt->inputTab[0]->encoding != NULL) && (ctxt->myDoc != NULL) &&
1042 (ctxt->myDoc->encoding == NULL)) { 1072 (ctxt->myDoc->encoding == NULL)) {
1043 ctxt->myDoc->encoding = xmlStrdup(ctxt->inputTab[0]->encoding); 1073 ctxt->myDoc->encoding = xmlStrdup(ctxt->inputTab[0]->encoding);
1044 } 1074 }
1045 if ((ctxt->charset != XML_CHAR_ENCODING_NONE) && (ctxt->myDoc != NULL) && 1075 if ((ctxt->charset != XML_CHAR_ENCODING_NONE) && (ctxt->myDoc != NULL) &&
1046 (ctxt->myDoc->charset == XML_CHAR_ENCODING_NONE)) { 1076 (ctxt->myDoc->charset == XML_CHAR_ENCODING_NONE)) {
1047 ctxt->myDoc->charset = ctxt->charset; 1077 ctxt->myDoc->charset = ctxt->charset;
1048 } 1078 }
1049 } 1079 }
1050 1080
1051 #if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBX ML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) 1081 #if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBX ML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENAB LED)
1052 /** 1082 /**
1053 * xmlSAX2AttributeInternal: 1083 * xmlSAX2AttributeInternal:
1054 * @ctx: the user data (XML parser context) 1084 * @ctx: the user data (XML parser context)
1055 * @fullname: The attribute name, including namespace prefix 1085 * @fullname: The attribute name, including namespace prefix
1056 * @value: The attribute value 1086 * @value: The attribute value
1057 * @prefix: the prefix on the element node 1087 * @prefix: the prefix on the element node
1058 * 1088 *
1059 * Handle an attribute that has been read by the parser. 1089 * Handle an attribute that has been read by the parser.
1060 * The default handling is to convert the attribute into an 1090 * The default handling is to convert the attribute into an
1061 * DOM subtree and past it in a new xmlAttr element added to 1091 * DOM subtree and past it in a new xmlAttr element added to
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 (name[0] == 'x') && (name[1] == 'm') && (name[2] == 'l') && 1170 (name[0] == 'x') && (name[1] == 'm') && (name[2] == 'l') &&
1141 (name[3] == 'n') && (name[4] == 's') && (name[5] == 0)) { 1171 (name[3] == 'n') && (name[4] == 's') && (name[5] == 0)) {
1142 xmlNsPtr nsret; 1172 xmlNsPtr nsret;
1143 xmlChar *val; 1173 xmlChar *val;
1144 1174
1145 if (!ctxt->replaceEntities) { 1175 if (!ctxt->replaceEntities) {
1146 ctxt->depth++; 1176 ctxt->depth++;
1147 val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF, 1177 val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF,
1148 0,0,0); 1178 0,0,0);
1149 ctxt->depth--; 1179 ctxt->depth--;
1180 if (val == NULL) {
1181 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement");
1182 if (name != NULL)
1183 xmlFree(name);
1184 return;
1185 }
1150 } else { 1186 } else {
1151 val = (xmlChar *) value; 1187 val = (xmlChar *) value;
1152 } 1188 }
1153 1189
1154 if (val[0] != 0) { 1190 if (val[0] != 0) {
1155 xmlURIPtr uri; 1191 xmlURIPtr uri;
1156 1192
1157 uri = xmlParseURI((const char *)val); 1193 uri = xmlParseURI((const char *)val);
1158 if (uri == NULL) { 1194 if (uri == NULL) {
1159 if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) 1195 if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
1160 » » ctxt->sax->warning(ctxt->userData, 1196 » » ctxt->sax->warning(ctxt->userData,
1161 "xmlns: %s not a valid URI\n", val); 1197 "xmlns: %s not a valid URI\n", val);
1162 } else { 1198 } else {
1163 if (uri->scheme == NULL) { 1199 if (uri->scheme == NULL) {
1164 if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) 1200 if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
1165 » » » ctxt->sax->warning(ctxt->userData, 1201 » » » ctxt->sax->warning(ctxt->userData,
1166 "xmlns: URI %s is not absolute\n", val); 1202 "xmlns: URI %s is not absolute\n", val);
1167 } 1203 }
1168 xmlFreeURI(uri); 1204 xmlFreeURI(uri);
1169 } 1205 }
1170 } 1206 }
1171 1207
1172 /* a default namespace definition */ 1208 /* a default namespace definition */
1173 nsret = xmlNewNs(ctxt->node, val, NULL); 1209 nsret = xmlNewNs(ctxt->node, val, NULL);
1174 1210
1175 #ifdef LIBXML_VALID_ENABLED 1211 #ifdef LIBXML_VALID_ENABLED
1176 /* 1212 /*
1177 * Validate also for namespace decls, they are attributes from 1213 * Validate also for namespace decls, they are attributes from
1178 * an XML-1.0 perspective 1214 * an XML-1.0 perspective
1179 */ 1215 */
1180 if (nsret != NULL && ctxt->validate && ctxt->wellFormed && 1216 if (nsret != NULL && ctxt->validate && ctxt->wellFormed &&
1181 ctxt->myDoc && ctxt->myDoc->intSubset) 1217 ctxt->myDoc && ctxt->myDoc->intSubset)
1182 ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc, 1218 ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc,
1183 ctxt->node, prefix, nsret, val); 1219 ctxt->node, prefix, nsret, val);
1184 #endif /* LIBXML_VALID_ENABLED */ 1220 #endif /* LIBXML_VALID_ENABLED */
1185 » if (name != NULL) 1221 » if (name != NULL)
1186 xmlFree(name); 1222 xmlFree(name);
1187 if (nval != NULL) 1223 if (nval != NULL)
1188 xmlFree(nval); 1224 xmlFree(nval);
1189 if (val != value) 1225 if (val != value)
1190 xmlFree(val); 1226 xmlFree(val);
1191 return; 1227 return;
1192 } 1228 }
1193 if ((!ctxt->html) && 1229 if ((!ctxt->html) &&
1194 (ns != NULL) && (ns[0] == 'x') && (ns[1] == 'm') && (ns[2] == 'l') && 1230 (ns != NULL) && (ns[0] == 'x') && (ns[1] == 'm') && (ns[2] == 'l') &&
1195 (ns[3] == 'n') && (ns[4] == 's') && (ns[5] == 0)) { 1231 (ns[3] == 'n') && (ns[4] == 's') && (ns[5] == 0)) {
1196 xmlNsPtr nsret; 1232 xmlNsPtr nsret;
1197 xmlChar *val; 1233 xmlChar *val;
1198 1234
1199 if (!ctxt->replaceEntities) { 1235 if (!ctxt->replaceEntities) {
1200 ctxt->depth++; 1236 ctxt->depth++;
1201 val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF, 1237 val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF,
1202 0,0,0); 1238 0,0,0);
1203 ctxt->depth--; 1239 ctxt->depth--;
1204 if (val == NULL) { 1240 if (val == NULL) {
1205 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement"); 1241 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElement");
1206 xmlFree(ns); 1242 xmlFree(ns);
1207 » » if (name != NULL) 1243 » » if (name != NULL)
1208 xmlFree(name); 1244 xmlFree(name);
1209 return; 1245 return;
1210 } 1246 }
1211 } else { 1247 } else {
1212 val = (xmlChar *) value; 1248 val = (xmlChar *) value;
1213 } 1249 }
1214 1250
1215 if (val[0] == 0) { 1251 if (val[0] == 0) {
1216 xmlNsErrMsg(ctxt, XML_NS_ERR_EMPTY, 1252 xmlNsErrMsg(ctxt, XML_NS_ERR_EMPTY,
1217 "Empty namespace name for prefix %s\n", name, NULL); 1253 "Empty namespace name for prefix %s\n", name, NULL);
(...skipping 20 matching lines...) Expand all
1238 #ifdef LIBXML_VALID_ENABLED 1274 #ifdef LIBXML_VALID_ENABLED
1239 /* 1275 /*
1240 * Validate also for namespace decls, they are attributes from 1276 * Validate also for namespace decls, they are attributes from
1241 * an XML-1.0 perspective 1277 * an XML-1.0 perspective
1242 */ 1278 */
1243 if (nsret != NULL && ctxt->validate && ctxt->wellFormed && 1279 if (nsret != NULL && ctxt->validate && ctxt->wellFormed &&
1244 ctxt->myDoc && ctxt->myDoc->intSubset) 1280 ctxt->myDoc && ctxt->myDoc->intSubset)
1245 ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc, 1281 ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc,
1246 ctxt->node, prefix, nsret, value); 1282 ctxt->node, prefix, nsret, value);
1247 #endif /* LIBXML_VALID_ENABLED */ 1283 #endif /* LIBXML_VALID_ENABLED */
1248 » if (name != NULL) 1284 » if (name != NULL)
1249 xmlFree(name); 1285 xmlFree(name);
1250 if (nval != NULL) 1286 if (nval != NULL)
1251 xmlFree(nval); 1287 xmlFree(nval);
1252 if (val != value) 1288 if (val != value)
1253 xmlFree(val); 1289 xmlFree(val);
1254 return; 1290 return;
1255 } 1291 }
1256 1292
1257 if (ns != NULL) { 1293 if (ns != NULL) {
1258 namespace = xmlSearchNs(ctxt->myDoc, ctxt->node, ns); 1294 namespace = xmlSearchNs(ctxt->myDoc, ctxt->node, ns);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 ret->children = xmlNewDocText(ctxt->myDoc, value); 1340 ret->children = xmlNewDocText(ctxt->myDoc, value);
1305 ret->last = ret->children; 1341 ret->last = ret->children;
1306 if (ret->children != NULL) 1342 if (ret->children != NULL)
1307 ret->children->parent = (xmlNodePtr) ret; 1343 ret->children->parent = (xmlNodePtr) ret;
1308 } 1344 }
1309 } 1345 }
1310 1346
1311 #ifdef LIBXML_VALID_ENABLED 1347 #ifdef LIBXML_VALID_ENABLED
1312 if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed && 1348 if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed &&
1313 ctxt->myDoc && ctxt->myDoc->intSubset) { 1349 ctxt->myDoc && ctxt->myDoc->intSubset) {
1314 » 1350
1315 /* 1351 /*
1316 * If we don't substitute entities, the validation should be 1352 * If we don't substitute entities, the validation should be
1317 * done on a value with replaced entities anyway. 1353 * done on a value with replaced entities anyway.
1318 */ 1354 */
1319 if (!ctxt->replaceEntities) { 1355 if (!ctxt->replaceEntities) {
1320 xmlChar *val; 1356 xmlChar *val;
1321 1357
1322 ctxt->depth++; 1358 ctxt->depth++;
1323 val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF, 1359 val = xmlStringDecodeEntities(ctxt, value, XML_SUBSTITUTE_REF,
1324 0,0,0); 1360 0,0,0);
1325 ctxt->depth--; 1361 ctxt->depth--;
1326 » 1362
1327 if (val == NULL) 1363 if (val == NULL)
1328 ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt, 1364 ctxt->valid &= xmlValidateOneAttribute(&ctxt->vctxt,
1329 ctxt->myDoc, ctxt->node, ret, value); 1365 ctxt->myDoc, ctxt->node, ret, value);
1330 else { 1366 else {
1331 xmlChar *nvalnorm; 1367 xmlChar *nvalnorm;
1332 1368
1333 /* 1369 /*
1334 * Do the last stage of the attribute normalization 1370 * Do the last stage of the attribute normalization
1335 * It need to be done twice ... it's an extra burden related 1371 * It need to be done twice ... it's an extra burden related
1336 * to the ability to keep xmlSAX2References in attributes 1372 * to the ability to keep xmlSAX2References in attributes
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 xmlAddID(&ctxt->vctxt, ctxt->myDoc, value, ret); 1409 xmlAddID(&ctxt->vctxt, ctxt->myDoc, value, ret);
1374 } else if (xmlIsID(ctxt->myDoc, ctxt->node, ret)) 1410 } else if (xmlIsID(ctxt->myDoc, ctxt->node, ret))
1375 xmlAddID(&ctxt->vctxt, ctxt->myDoc, value, ret); 1411 xmlAddID(&ctxt->vctxt, ctxt->myDoc, value, ret);
1376 else if (xmlIsRef(ctxt->myDoc, ctxt->node, ret)) 1412 else if (xmlIsRef(ctxt->myDoc, ctxt->node, ret))
1377 xmlAddRef(&ctxt->vctxt, ctxt->myDoc, value, ret); 1413 xmlAddRef(&ctxt->vctxt, ctxt->myDoc, value, ret);
1378 } 1414 }
1379 1415
1380 error: 1416 error:
1381 if (nval != NULL) 1417 if (nval != NULL)
1382 xmlFree(nval); 1418 xmlFree(nval);
1383 if (ns != NULL) 1419 if (ns != NULL)
1384 xmlFree(ns); 1420 xmlFree(ns);
1385 } 1421 }
1386 1422
1387 /* 1423 /*
1388 * xmlCheckDefaultedAttributes: 1424 * xmlCheckDefaultedAttributes:
1389 * 1425 *
1390 * Check defaulted attributes from the DTD 1426 * Check defaulted attributes from the DTD
1391 */ 1427 */
1392 static void 1428 static void
1393 xmlCheckDefaultedAttributes(xmlParserCtxtPtr ctxt, const xmlChar *name, 1429 xmlCheckDefaultedAttributes(xmlParserCtxtPtr ctxt, const xmlChar *name,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 * Make sure that attributes redefinition occuring in the 1508 * Make sure that attributes redefinition occuring in the
1473 * internal subset are not overriden by definitions in the 1509 * internal subset are not overriden by definitions in the
1474 * external subset. 1510 * external subset.
1475 */ 1511 */
1476 if (attr->defaultValue != NULL) { 1512 if (attr->defaultValue != NULL) {
1477 /* 1513 /*
1478 * the element should be instantiated in the tree if: 1514 * the element should be instantiated in the tree if:
1479 * - this is a namespace prefix 1515 * - this is a namespace prefix
1480 * - the user required for completion in the tree 1516 * - the user required for completion in the tree
1481 * like XSLT 1517 * like XSLT
1482 » » * - there isn't already an attribute definition 1518 » » * - there isn't already an attribute definition
1483 * in the internal subset overriding it. 1519 * in the internal subset overriding it.
1484 */ 1520 */
1485 if (((attr->prefix != NULL) && 1521 if (((attr->prefix != NULL) &&
1486 (xmlStrEqual(attr->prefix, BAD_CAST "xmlns"))) || 1522 (xmlStrEqual(attr->prefix, BAD_CAST "xmlns"))) ||
1487 ((attr->prefix == NULL) && 1523 ((attr->prefix == NULL) &&
1488 (xmlStrEqual(attr->name, BAD_CAST "xmlns"))) || 1524 (xmlStrEqual(attr->name, BAD_CAST "xmlns"))) ||
1489 (ctxt->loadsubset & XML_COMPLETE_ATTRS)) { 1525 (ctxt->loadsubset & XML_COMPLETE_ATTRS)) {
1490 xmlAttributePtr tst; 1526 xmlAttributePtr tst;
1491 1527
1492 tst = xmlGetDtdQAttrDesc(ctxt->myDoc->intSubset, 1528 tst = xmlGetDtdQAttrDesc(ctxt->myDoc->intSubset,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1561 if ((ctx == NULL) || (fullname == NULL) || (ctxt->myDoc == NULL)) return; 1597 if ((ctx == NULL) || (fullname == NULL) || (ctxt->myDoc == NULL)) return;
1562 parent = ctxt->node; 1598 parent = ctxt->node;
1563 #ifdef DEBUG_SAX 1599 #ifdef DEBUG_SAX
1564 xmlGenericError(xmlGenericErrorContext, 1600 xmlGenericError(xmlGenericErrorContext,
1565 "SAX.xmlSAX2StartElement(%s)\n", fullname); 1601 "SAX.xmlSAX2StartElement(%s)\n", fullname);
1566 #endif 1602 #endif
1567 1603
1568 /* 1604 /*
1569 * First check on validity: 1605 * First check on validity:
1570 */ 1606 */
1571 if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) && 1607 if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) &&
1572 ((ctxt->myDoc->intSubset == NULL) || 1608 ((ctxt->myDoc->intSubset == NULL) ||
1573 » ((ctxt->myDoc->intSubset->notations == NULL) && 1609 » ((ctxt->myDoc->intSubset->notations == NULL) &&
1574 (ctxt->myDoc->intSubset->elements == NULL) && 1610 (ctxt->myDoc->intSubset->elements == NULL) &&
1575 » (ctxt->myDoc->intSubset->attributes == NULL) && 1611 » (ctxt->myDoc->intSubset->attributes == NULL) &&
1576 (ctxt->myDoc->intSubset->entities == NULL)))) { 1612 (ctxt->myDoc->intSubset->entities == NULL)))) {
1577 xmlErrValid(ctxt, XML_ERR_NO_DTD, 1613 xmlErrValid(ctxt, XML_ERR_NO_DTD,
1578 "Validation failed: no DTD found !", NULL, NULL); 1614 "Validation failed: no DTD found !", NULL, NULL);
1579 ctxt->validate = 0; 1615 ctxt->validate = 0;
1580 } 1616 }
1581 1617
1582 1618
1583 /* 1619 /*
1584 * Split the full name into a namespace prefix and the tag name 1620 * Split the full name into a namespace prefix and the tag name
1585 */ 1621 */
1586 name = xmlSplitQName(ctxt, fullname, &prefix); 1622 name = xmlSplitQName(ctxt, fullname, &prefix);
1587 1623
1588 1624
1589 /* 1625 /*
1590 * Note : the namespace resolution is deferred until the end of the 1626 * Note : the namespace resolution is deferred until the end of the
1591 * attributes parsing, since local namespace can be defined as 1627 * attributes parsing, since local namespace can be defined as
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1749 * xmlSAX2EndElement: 1785 * xmlSAX2EndElement:
1750 * @ctx: the user data (XML parser context) 1786 * @ctx: the user data (XML parser context)
1751 * @name: The element name 1787 * @name: The element name
1752 * 1788 *
1753 * called when the end of an element has been detected. 1789 * called when the end of an element has been detected.
1754 */ 1790 */
1755 void 1791 void
1756 xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED) 1792 xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED)
1757 { 1793 {
1758 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; 1794 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
1759 xmlParserNodeInfo node_info;
1760 xmlNodePtr cur; 1795 xmlNodePtr cur;
1761 1796
1762 if (ctx == NULL) return; 1797 if (ctx == NULL) return;
1763 cur = ctxt->node; 1798 cur = ctxt->node;
1764 #ifdef DEBUG_SAX 1799 #ifdef DEBUG_SAX
1765 if (name == NULL) 1800 if (name == NULL)
1766 xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2EndElement(NULL)\n") ; 1801 xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2EndElement(NULL)\n") ;
1767 else 1802 else
1768 xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2EndElement(%s)\n", n ame); 1803 xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2EndElement(%s)\n", n ame);
1769 #endif 1804 #endif
1770 1805
1771 /* Capture end position and add node */ 1806 /* Capture end position and add node */
1772 if (cur != NULL && ctxt->record_info) { 1807 if (cur != NULL && ctxt->record_info) {
1773 node_info.end_pos = ctxt->input->cur - ctxt->input->base; 1808 ctxt->nodeInfo->end_pos = ctxt->input->cur - ctxt->input->base;
1774 node_info.end_line = ctxt->input->line; 1809 ctxt->nodeInfo->end_line = ctxt->input->line;
1775 node_info.node = cur; 1810 ctxt->nodeInfo->node = cur;
1776 xmlParserAddNodeInfo(ctxt, &node_info); 1811 xmlParserAddNodeInfo(ctxt, ctxt->nodeInfo);
1777 } 1812 }
1778 ctxt->nodemem = -1; 1813 ctxt->nodemem = -1;
1779 1814
1780 #ifdef LIBXML_VALID_ENABLED 1815 #ifdef LIBXML_VALID_ENABLED
1781 if (ctxt->validate && ctxt->wellFormed && 1816 if (ctxt->validate && ctxt->wellFormed &&
1782 ctxt->myDoc && ctxt->myDoc->intSubset) 1817 ctxt->myDoc && ctxt->myDoc->intSubset)
1783 ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc, 1818 ctxt->valid &= xmlValidateOneElement(&ctxt->vctxt, ctxt->myDoc,
1784 cur); 1819 cur);
1785 #endif /* LIBXML_VALID_ENABLED */ 1820 #endif /* LIBXML_VALID_ENABLED */
1786 1821
1787 1822
1788 /* 1823 /*
1789 * end of parsing of this node. 1824 * end of parsing of this node.
1790 */ 1825 */
1791 #ifdef DEBUG_SAX_TREE 1826 #ifdef DEBUG_SAX_TREE
1792 xmlGenericError(xmlGenericErrorContext, "popping(%s)\n", cur->name); 1827 xmlGenericError(xmlGenericErrorContext, "popping(%s)\n", cur->name);
1793 #endif 1828 #endif
1794 nodePop(ctxt); 1829 nodePop(ctxt);
1795 } 1830 }
1796 #endif /* LIBXML_SAX1_ENABLED || LIBXML_HTML_ENABLE */ 1831 #endif /* LIBXML_SAX1_ENABLED || LIBXML_HTML_ENABLED || LIBXML_LEGACY_ENABLED */
1797 1832
1798 /* 1833 /*
1799 * xmlSAX2TextNode: 1834 * xmlSAX2TextNode:
1800 * @ctxt: the parser context 1835 * @ctxt: the parser context
1801 * @str: the input string 1836 * @str: the input string
1802 * @len: the string length 1837 * @len: the string length
1803 * 1838 *
1804 * Remove the entities from an attribute value 1839 * Callback for a text node
1805 * 1840 *
1806 * Returns the newly allocated string or NULL if not needed or error 1841 * Returns the newly allocated string or NULL if not needed or error
1807 */ 1842 */
1808 static xmlNodePtr 1843 static xmlNodePtr
1809 xmlSAX2TextNode(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) { 1844 xmlSAX2TextNode(xmlParserCtxtPtr ctxt, const xmlChar *str, int len) {
1810 xmlNodePtr ret; 1845 xmlNodePtr ret;
1811 const xmlChar *intern = NULL; 1846 const xmlChar *intern = NULL;
1812 1847
1813 /* 1848 /*
1814 * Allocate 1849 * Allocate
(...skipping 12 matching lines...) Expand all
1827 memset(ret, 0, sizeof(xmlNode)); 1862 memset(ret, 0, sizeof(xmlNode));
1828 /* 1863 /*
1829 * intern the formatting blanks found between tags, or the 1864 * intern the formatting blanks found between tags, or the
1830 * very short strings 1865 * very short strings
1831 */ 1866 */
1832 if (ctxt->dictNames) { 1867 if (ctxt->dictNames) {
1833 xmlChar cur = str[len]; 1868 xmlChar cur = str[len];
1834 1869
1835 if ((len < (int) (2 * sizeof(void *))) && 1870 if ((len < (int) (2 * sizeof(void *))) &&
1836 (ctxt->options & XML_PARSE_COMPACT)) { 1871 (ctxt->options & XML_PARSE_COMPACT)) {
1837 » /* store the string in the node overrithing properties and nsDef */ 1872 » /* store the string in the node overriding properties and nsDef */
1838 xmlChar *tmp = (xmlChar *) &(ret->properties); 1873 xmlChar *tmp = (xmlChar *) &(ret->properties);
1839 memcpy(tmp, str, len); 1874 memcpy(tmp, str, len);
1840 tmp[len] = 0; 1875 tmp[len] = 0;
1841 intern = tmp; 1876 intern = tmp;
1842 } else if ((len <= 3) && ((cur == '"') || (cur == '\'') || 1877 } else if ((len <= 3) && ((cur == '"') || (cur == '\'') ||
1843 ((cur == '<') && (str[len + 1] != '!')))) { 1878 ((cur == '<') && (str[len + 1] != '!')))) {
1844 intern = xmlDictLookup(ctxt->dict, str, len); 1879 intern = xmlDictLookup(ctxt->dict, str, len);
1845 } else if (IS_BLANK_CH(*str) && (len < 60) && (cur == '<') && 1880 } else if (IS_BLANK_CH(*str) && (len < 60) && (cur == '<') &&
1846 (str[len + 1] != '!')) { 1881 (str[len + 1] != '!')) {
1847 int i; 1882 int i;
(...skipping 11 matching lines...) Expand all
1859 if (intern == NULL) { 1894 if (intern == NULL) {
1860 ret->content = xmlStrndup(str, len); 1895 ret->content = xmlStrndup(str, len);
1861 if (ret->content == NULL) { 1896 if (ret->content == NULL) {
1862 xmlSAX2ErrMemory(ctxt, "xmlSAX2TextNode"); 1897 xmlSAX2ErrMemory(ctxt, "xmlSAX2TextNode");
1863 xmlFree(ret); 1898 xmlFree(ret);
1864 return(NULL); 1899 return(NULL);
1865 } 1900 }
1866 } else 1901 } else
1867 ret->content = (xmlChar *) intern; 1902 ret->content = (xmlChar *) intern;
1868 1903
1869 if (ctxt->input != NULL) 1904 if (ctxt->linenumbers) {
1870 ret->line = ctxt->input->line; 1905 » if (ctxt->input != NULL) {
1906 » if (ctxt->input->line < 65535)
1907 » » ret->line = (short) ctxt->input->line;
1908 » else {
1909 » ret->line = 65535;
1910 » » if (ctxt->options & XML_PARSE_BIG_LINES)
1911 » » ret->psvi = (void *) (long) ctxt->input->line;
1912 » }
1913 » }
1914 }
1871 1915
1872 if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue)) 1916 if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
1873 xmlRegisterNodeDefaultValue(ret); 1917 xmlRegisterNodeDefaultValue(ret);
1874 return(ret); 1918 return(ret);
1875 } 1919 }
1876 1920
1877 #ifdef LIBXML_VALID_ENABLED 1921 #ifdef LIBXML_VALID_ENABLED
1878 /* 1922 /*
1879 * xmlSAX2DecodeAttrEntities: 1923 * xmlSAX2DecodeAttrEntities:
1880 * @ctxt: the parser context 1924 * @ctxt: the parser context
1881 * @str: the input string 1925 * @str: the input string
1882 * @len: the string length 1926 * @len: the string length
1883 * 1927 *
1884 * Remove the entities from an attribute value 1928 * Remove the entities from an attribute value
1885 * 1929 *
1886 * Returns the newly allocated string or NULL if not needed or error 1930 * Returns the newly allocated string or NULL if not needed or error
1887 */ 1931 */
1888 static xmlChar * 1932 static xmlChar *
1889 xmlSAX2DecodeAttrEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, 1933 xmlSAX2DecodeAttrEntities(xmlParserCtxtPtr ctxt, const xmlChar *str,
1890 const xmlChar *end) { 1934 const xmlChar *end) {
1891 const xmlChar *in; 1935 const xmlChar *in;
1892 xmlChar *ret; 1936 xmlChar *ret;
1893 1937
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 /* 1983 /*
1940 * allocate the node 1984 * allocate the node
1941 */ 1985 */
1942 if (ctxt->freeAttrs != NULL) { 1986 if (ctxt->freeAttrs != NULL) {
1943 ret = ctxt->freeAttrs; 1987 ret = ctxt->freeAttrs;
1944 ctxt->freeAttrs = ret->next; 1988 ctxt->freeAttrs = ret->next;
1945 ctxt->freeAttrsNr--; 1989 ctxt->freeAttrsNr--;
1946 memset(ret, 0, sizeof(xmlAttr)); 1990 memset(ret, 0, sizeof(xmlAttr));
1947 ret->type = XML_ATTRIBUTE_NODE; 1991 ret->type = XML_ATTRIBUTE_NODE;
1948 1992
1949 » ret->parent = ctxt->node; 1993 » ret->parent = ctxt->node;
1950 ret->doc = ctxt->myDoc; 1994 ret->doc = ctxt->myDoc;
1951 ret->ns = namespace; 1995 ret->ns = namespace;
1952 1996
1953 if (ctxt->dictNames) 1997 if (ctxt->dictNames)
1954 ret->name = localname; 1998 ret->name = localname;
1955 else 1999 else
1956 ret->name = xmlStrdup(localname); 2000 ret->name = xmlStrdup(localname);
1957 2001
1958 /* link at the end to preserv order, TODO speed up with a last */ 2002 /* link at the end to preserv order, TODO speed up with a last */
1959 if (ctxt->node->properties == NULL) { 2003 if (ctxt->node->properties == NULL) {
1960 ctxt->node->properties = ret; 2004 ctxt->node->properties = ret;
1961 } else { 2005 } else {
1962 xmlAttrPtr prev = ctxt->node->properties; 2006 xmlAttrPtr prev = ctxt->node->properties;
1963 2007
1964 while (prev->next != NULL) prev = prev->next; 2008 while (prev->next != NULL) prev = prev->next;
1965 prev->next = ret; 2009 prev->next = ret;
1966 ret->prev = prev; 2010 ret->prev = prev;
1967 } 2011 }
1968 2012
1969 if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue)) 2013 if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
1970 xmlRegisterNodeDefaultValue((xmlNodePtr)ret); 2014 xmlRegisterNodeDefaultValue((xmlNodePtr)ret);
1971 } else { 2015 } else {
1972 if (ctxt->dictNames) 2016 if (ctxt->dictNames)
1973 » ret = xmlNewNsPropEatName(ctxt->node, namespace, 2017 » ret = xmlNewNsPropEatName(ctxt->node, namespace,
1974 (xmlChar *) localname, NULL); 2018 (xmlChar *) localname, NULL);
1975 else 2019 else
1976 ret = xmlNewNsProp(ctxt->node, namespace, localname, NULL); 2020 ret = xmlNewNsProp(ctxt->node, namespace, localname, NULL);
1977 if (ret == NULL) { 2021 if (ret == NULL) {
1978 xmlErrMemory(ctxt, "xmlSAX2AttributeNs"); 2022 xmlErrMemory(ctxt, "xmlSAX2AttributeNs");
1979 return; 2023 return;
1980 } 2024 }
1981 } 2025 }
1982 2026
1983 if ((ctxt->replaceEntities == 0) && (!ctxt->html)) { 2027 if ((ctxt->replaceEntities == 0) && (!ctxt->html)) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 * dup now contains a string of the flattened attribute 2093 * dup now contains a string of the flattened attribute
2050 * content with entities substitued. Check if we need to 2094 * content with entities substitued. Check if we need to
2051 * apply an extra layer of normalization. 2095 * apply an extra layer of normalization.
2052 * It need to be done twice ... it's an extra burden related 2096 * It need to be done twice ... it's an extra burden related
2053 * to the ability to keep references in attributes 2097 * to the ability to keep references in attributes
2054 */ 2098 */
2055 if (ctxt->attsSpecial != NULL) { 2099 if (ctxt->attsSpecial != NULL) {
2056 xmlChar *nvalnorm; 2100 xmlChar *nvalnorm;
2057 xmlChar fn[50]; 2101 xmlChar fn[50];
2058 xmlChar *fullname; 2102 xmlChar *fullname;
2059 » » 2103
2060 fullname = xmlBuildQName(localname, prefix, fn, 50); 2104 fullname = xmlBuildQName(localname, prefix, fn, 50);
2061 if (fullname != NULL) { 2105 if (fullname != NULL) {
2062 ctxt->vctxt.valid = 1; 2106 ctxt->vctxt.valid = 1;
2063 nvalnorm = xmlValidCtxtNormalizeAttributeValue( 2107 nvalnorm = xmlValidCtxtNormalizeAttributeValue(
2064 &ctxt->vctxt, ctxt->myDoc, 2108 &ctxt->vctxt, ctxt->myDoc,
2065 ctxt->node, fullname, dup); 2109 ctxt->node, fullname, dup);
2066 if (ctxt->vctxt.valid != 1) 2110 if (ctxt->vctxt.valid != 1)
2067 ctxt->valid = 0; 2111 ctxt->valid = 0;
2068 2112
2069 if ((fullname != fn) && (fullname != localname)) 2113 if ((fullname != fn) && (fullname != localname))
(...skipping 30 matching lines...) Expand all
2100 if ((prefix == ctxt->str_xml) && 2144 if ((prefix == ctxt->str_xml) &&
2101 (localname[0] == 'i') && (localname[1] == 'd') && 2145 (localname[0] == 'i') && (localname[1] == 'd') &&
2102 (localname[2] == 0)) { 2146 (localname[2] == 0)) {
2103 /* 2147 /*
2104 * Add the xml:id value 2148 * Add the xml:id value
2105 * 2149 *
2106 * Open issue: normalization of the value. 2150 * Open issue: normalization of the value.
2107 */ 2151 */
2108 if (dup == NULL) 2152 if (dup == NULL)
2109 dup = xmlStrndup(value, valueend - value); 2153 dup = xmlStrndup(value, valueend - value);
2154 #if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBX ML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENAB LED)
2110 #ifdef LIBXML_VALID_ENABLED 2155 #ifdef LIBXML_VALID_ENABLED
2111 if (xmlValidateNCName(dup, 1) != 0) { 2156 if (xmlValidateNCName(dup, 1) != 0) {
2112 xmlErrValid(ctxt, XML_DTD_XMLID_VALUE, 2157 xmlErrValid(ctxt, XML_DTD_XMLID_VALUE,
2113 "xml:id : attribute value %s is not an NCName\n", 2158 "xml:id : attribute value %s is not an NCName\n",
2114 (const char *) dup, NULL); 2159 (const char *) dup, NULL);
2115 } 2160 }
2116 #endif 2161 #endif
2162 #endif
2117 xmlAddID(&ctxt->vctxt, ctxt->myDoc, dup, ret); 2163 xmlAddID(&ctxt->vctxt, ctxt->myDoc, dup, ret);
2118 } else if (xmlIsID(ctxt->myDoc, ctxt->node, ret)) { 2164 } else if (xmlIsID(ctxt->myDoc, ctxt->node, ret)) {
2119 /* might be worth duplicate entry points and not copy */ 2165 /* might be worth duplicate entry points and not copy */
2120 if (dup == NULL) 2166 if (dup == NULL)
2121 dup = xmlStrndup(value, valueend - value); 2167 dup = xmlStrndup(value, valueend - value);
2122 xmlAddID(&ctxt->vctxt, ctxt->myDoc, dup, ret); 2168 xmlAddID(&ctxt->vctxt, ctxt->myDoc, dup, ret);
2123 } else if (xmlIsRef(ctxt->myDoc, ctxt->node, ret)) { 2169 } else if (xmlIsRef(ctxt->myDoc, ctxt->node, ret)) {
2124 if (dup == NULL) 2170 if (dup == NULL)
2125 dup = xmlStrndup(value, valueend - value); 2171 dup = xmlStrndup(value, valueend - value);
2126 xmlAddRef(&ctxt->vctxt, ctxt->myDoc, dup, ret); 2172 xmlAddRef(&ctxt->vctxt, ctxt->myDoc, dup, ret);
(...skipping 29 matching lines...) Expand all
2156 const xmlChar **namespaces, 2202 const xmlChar **namespaces,
2157 int nb_attributes, 2203 int nb_attributes,
2158 int nb_defaulted, 2204 int nb_defaulted,
2159 const xmlChar **attributes) 2205 const xmlChar **attributes)
2160 { 2206 {
2161 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; 2207 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
2162 xmlNodePtr ret; 2208 xmlNodePtr ret;
2163 xmlNodePtr parent; 2209 xmlNodePtr parent;
2164 xmlNsPtr last = NULL, ns; 2210 xmlNsPtr last = NULL, ns;
2165 const xmlChar *uri, *pref; 2211 const xmlChar *uri, *pref;
2212 xmlChar *lname = NULL;
2166 int i, j; 2213 int i, j;
2167 2214
2168 if (ctx == NULL) return; 2215 if (ctx == NULL) return;
2169 parent = ctxt->node; 2216 parent = ctxt->node;
2170 /* 2217 /*
2171 * First check on validity: 2218 * First check on validity:
2172 */ 2219 */
2173 if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) && 2220 if (ctxt->validate && (ctxt->myDoc->extSubset == NULL) &&
2174 ((ctxt->myDoc->intSubset == NULL) || 2221 ((ctxt->myDoc->intSubset == NULL) ||
2175 » ((ctxt->myDoc->intSubset->notations == NULL) && 2222 » ((ctxt->myDoc->intSubset->notations == NULL) &&
2176 (ctxt->myDoc->intSubset->elements == NULL) && 2223 (ctxt->myDoc->intSubset->elements == NULL) &&
2177 » (ctxt->myDoc->intSubset->attributes == NULL) && 2224 » (ctxt->myDoc->intSubset->attributes == NULL) &&
2178 (ctxt->myDoc->intSubset->entities == NULL)))) { 2225 (ctxt->myDoc->intSubset->entities == NULL)))) {
2179 » xmlErrValid(ctxt, XML_ERR_NO_DTD, 2226 » xmlErrValid(ctxt, XML_DTD_NO_DTD,
2180 "Validation failed: no DTD found !", NULL, NULL); 2227 "Validation failed: no DTD found !", NULL, NULL);
2181 ctxt->validate = 0; 2228 ctxt->validate = 0;
2182 } 2229 }
2183 2230
2184 /* 2231 /*
2232 * Take care of the rare case of an undefined namespace prefix
2233 */
2234 if ((prefix != NULL) && (URI == NULL)) {
2235 if (ctxt->dictNames) {
2236 const xmlChar *fullname;
2237
2238 fullname = xmlDictQLookup(ctxt->dict, prefix, localname);
2239 if (fullname != NULL)
2240 localname = fullname;
2241 } else {
2242 lname = xmlBuildQName(localname, prefix, NULL, 0);
2243 }
2244 }
2245 /*
2185 * allocate the node 2246 * allocate the node
2186 */ 2247 */
2187 if (ctxt->freeElems != NULL) { 2248 if (ctxt->freeElems != NULL) {
2188 ret = ctxt->freeElems; 2249 ret = ctxt->freeElems;
2189 ctxt->freeElems = ret->next; 2250 ctxt->freeElems = ret->next;
2190 ctxt->freeElemsNr--; 2251 ctxt->freeElemsNr--;
2191 memset(ret, 0, sizeof(xmlNode)); 2252 memset(ret, 0, sizeof(xmlNode));
2192 ret->type = XML_ELEMENT_NODE; 2253 ret->type = XML_ELEMENT_NODE;
2193 2254
2194 if (ctxt->dictNames) 2255 if (ctxt->dictNames)
2195 ret->name = localname; 2256 ret->name = localname;
2196 else { 2257 else {
2197 » ret->name = xmlStrdup(localname); 2258 » if (lname == NULL)
2259 » » ret->name = xmlStrdup(localname);
2260 » else
2261 » ret->name = lname;
2198 if (ret->name == NULL) { 2262 if (ret->name == NULL) {
2199 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); 2263 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");
2200 return; 2264 return;
2201 } 2265 }
2202 } 2266 }
2203 if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue)) 2267 if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
2204 xmlRegisterNodeDefaultValue(ret); 2268 xmlRegisterNodeDefaultValue(ret);
2205 } else { 2269 } else {
2206 if (ctxt->dictNames) 2270 if (ctxt->dictNames)
2207 » ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, 2271 » ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL,
2208 (xmlChar *) localname, NULL); 2272 (xmlChar *) localname, NULL);
2273 else if (lname == NULL)
2274 ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL);
2209 else 2275 else
2210 » ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL); 2276 » ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL,
2277 » (xmlChar *) lname, NULL);
2211 if (ret == NULL) { 2278 if (ret == NULL) {
2212 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); 2279 xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs");
2213 return; 2280 return;
2214 } 2281 }
2215 } 2282 }
2216 if (ctxt->linenumbers) { 2283 if (ctxt->linenumbers) {
2217 if (ctxt->input != NULL) { 2284 if (ctxt->input != NULL) {
2218 if (ctxt->input->line < 65535) 2285 if (ctxt->input->line < 65535)
2219 ret->line = (short) ctxt->input->line; 2286 ret->line = (short) ctxt->input->line;
2220 else 2287 else
2221 ret->line = 65535; 2288 ret->line = 65535;
2222 } 2289 }
2223 } 2290 }
2224 2291
2225 if ((ctxt->myDoc->children == NULL) || (parent == NULL)) { 2292 if (parent == NULL) {
2226 xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret); 2293 xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret);
2227 } 2294 }
2228 /* 2295 /*
2229 * Build the namespace list 2296 * Build the namespace list
2230 */ 2297 */
2231 for (i = 0,j = 0;j < nb_namespaces;j++) { 2298 for (i = 0,j = 0;j < nb_namespaces;j++) {
2232 pref = namespaces[i++]; 2299 pref = namespaces[i++];
2233 uri = namespaces[i++]; 2300 uri = namespaces[i++];
2234 ns = xmlNewNs(NULL, uri, pref); 2301 ns = xmlNewNs(NULL, uri, pref);
2235 if (ns != NULL) { 2302 if (ns != NULL) {
2236 if (last == NULL) { 2303 if (last == NULL) {
2237 ret->nsDef = last = ns; 2304 ret->nsDef = last = ns;
2238 } else { 2305 } else {
2239 last->next = ns; 2306 last->next = ns;
2240 last = ns; 2307 last = ns;
2241 } 2308 }
2242 if ((URI != NULL) && (prefix == pref)) 2309 if ((URI != NULL) && (prefix == pref))
2243 ret->ns = ns; 2310 ret->ns = ns;
2244 } else { 2311 } else {
2245 » xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); 2312 /*
2246 » return; 2313 * any out of memory error would already have been raised
2314 * but we can't be garanteed it's the actual error due to the
2315 * API, best is to skip in this case
2316 */
2317 » continue;
2247 } 2318 }
2248 #ifdef LIBXML_VALID_ENABLED 2319 #ifdef LIBXML_VALID_ENABLED
2249 if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed && 2320 if ((!ctxt->html) && ctxt->validate && ctxt->wellFormed &&
2250 ctxt->myDoc && ctxt->myDoc->intSubset) { 2321 ctxt->myDoc && ctxt->myDoc->intSubset) {
2251 ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc, 2322 ctxt->valid &= xmlValidateOneNamespace(&ctxt->vctxt, ctxt->myDoc,
2252 ret, prefix, ns, uri); 2323 ret, prefix, ns, uri);
2253 } 2324 }
2254 #endif /* LIBXML_VALID_ENABLED */ 2325 #endif /* LIBXML_VALID_ENABLED */
2255 } 2326 }
2256 ctxt->nodemem = -1; 2327 ctxt->nodemem = -1;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2303 "Namespace default prefix was not found\n", 2374 "Namespace default prefix was not found\n",
2304 NULL, NULL); 2375 NULL, NULL);
2305 } 2376 }
2306 } 2377 }
2307 2378
2308 /* 2379 /*
2309 * process all the other attributes 2380 * process all the other attributes
2310 */ 2381 */
2311 if (nb_attributes > 0) { 2382 if (nb_attributes > 0) {
2312 for (j = 0,i = 0;i < nb_attributes;i++,j+=5) { 2383 for (j = 0,i = 0;i < nb_attributes;i++,j+=5) {
2384 /*
2385 * Handle the rare case of an undefined atribute prefix
2386 */
2387 if ((attributes[j+1] != NULL) && (attributes[j+2] == NULL)) {
2388 if (ctxt->dictNames) {
2389 const xmlChar *fullname;
2390
2391 fullname = xmlDictQLookup(ctxt->dict, attributes[j+1],
2392 attributes[j]);
2393 if (fullname != NULL) {
2394 xmlSAX2AttributeNs(ctxt, fullname, NULL,
2395 attributes[j+3], attributes[j+4]);
2396 continue;
2397 }
2398 } else {
2399 lname = xmlBuildQName(attributes[j], attributes[j+1],
2400 NULL, 0);
2401 if (lname != NULL) {
2402 xmlSAX2AttributeNs(ctxt, lname, NULL,
2403 attributes[j+3], attributes[j+4]);
2404 xmlFree(lname);
2405 continue;
2406 }
2407 }
2408 }
2313 xmlSAX2AttributeNs(ctxt, attributes[j], attributes[j+1], 2409 xmlSAX2AttributeNs(ctxt, attributes[j], attributes[j+1],
2314 » attributes[j+3], attributes[j+4]); 2410 » » » attributes[j+3], attributes[j+4]);
2315 } 2411 }
2316 } 2412 }
2317 2413
2318 #ifdef LIBXML_VALID_ENABLED 2414 #ifdef LIBXML_VALID_ENABLED
2319 /* 2415 /*
2320 * If it's the Document root, finish the DTD validation and 2416 * If it's the Document root, finish the DTD validation and
2321 * check the document root element for validity 2417 * check the document root element for validity
2322 */ 2418 */
2323 if ((ctxt->validate) && (ctxt->vctxt.finishDtd == XML_CTXT_FINISH_DTD_0)) { 2419 if ((ctxt->validate) && (ctxt->vctxt.finishDtd == XML_CTXT_FINISH_DTD_0)) {
2324 int chk; 2420 int chk;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2375 * end of parsing of this node. 2471 * end of parsing of this node.
2376 */ 2472 */
2377 nodePop(ctxt); 2473 nodePop(ctxt);
2378 } 2474 }
2379 2475
2380 /** 2476 /**
2381 * xmlSAX2Reference: 2477 * xmlSAX2Reference:
2382 * @ctx: the user data (XML parser context) 2478 * @ctx: the user data (XML parser context)
2383 * @name: The entity name 2479 * @name: The entity name
2384 * 2480 *
2385 * called when an entity xmlSAX2Reference is detected. 2481 * called when an entity xmlSAX2Reference is detected.
2386 */ 2482 */
2387 void 2483 void
2388 xmlSAX2Reference(void *ctx, const xmlChar *name) 2484 xmlSAX2Reference(void *ctx, const xmlChar *name)
2389 { 2485 {
2390 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; 2486 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
2391 xmlNodePtr ret; 2487 xmlNodePtr ret;
2392 2488
2393 if (ctx == NULL) return; 2489 if (ctx == NULL) return;
2394 #ifdef DEBUG_SAX 2490 #ifdef DEBUG_SAX
2395 xmlGenericError(xmlGenericErrorContext, 2491 xmlGenericError(xmlGenericErrorContext,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
2475 * We try to minimaze realloc() uses and avoid copying 2571 * We try to minimaze realloc() uses and avoid copying
2476 * and recomputing length over and over. 2572 * and recomputing length over and over.
2477 */ 2573 */
2478 if (lastChild->content == (xmlChar *)&(lastChild->properties)) { 2574 if (lastChild->content == (xmlChar *)&(lastChild->properties)) {
2479 lastChild->content = xmlStrdup(lastChild->content); 2575 lastChild->content = xmlStrdup(lastChild->content);
2480 lastChild->properties = NULL; 2576 lastChild->properties = NULL;
2481 } else if ((ctxt->nodemem == ctxt->nodelen + 1) && 2577 } else if ((ctxt->nodemem == ctxt->nodelen + 1) &&
2482 (xmlDictOwns(ctxt->dict, lastChild->content))) { 2578 (xmlDictOwns(ctxt->dict, lastChild->content))) {
2483 lastChild->content = xmlStrdup(lastChild->content); 2579 lastChild->content = xmlStrdup(lastChild->content);
2484 } 2580 }
2581 if (lastChild->content == NULL) {
2582 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: xmlStrdup returned NU LL");
2583 return;
2584 }
2485 if (((size_t)ctxt->nodelen + (size_t)len > XML_MAX_TEXT_LENGTH) && 2585 if (((size_t)ctxt->nodelen + (size_t)len > XML_MAX_TEXT_LENGTH) &&
2486 ((ctxt->options & XML_PARSE_HUGE) == 0)) { 2586 ((ctxt->options & XML_PARSE_HUGE) == 0)) {
2487 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: huge text node"); 2587 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters: huge text node");
2488 return; 2588 return;
2489 } 2589 }
2490 » if ((size_t)ctxt->nodelen > SIZE_T_MAX - (size_t)len || 2590 » if ((size_t)ctxt->nodelen > SIZE_T_MAX - (size_t)len ||
2491 (size_t)ctxt->nodemem + (size_t)len > SIZE_T_MAX / 2) { 2591 (size_t)ctxt->nodemem + (size_t)len > SIZE_T_MAX / 2) {
2492 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters overflow prevented"); 2592 xmlSAX2ErrMemory(ctxt, "xmlSAX2Characters overflow prevented");
2493 return; 2593 return;
2494 } 2594 }
2495 if (ctxt->nodelen + len >= ctxt->nodemem) { 2595 if (ctxt->nodelen + len >= ctxt->nodemem) {
2496 xmlChar *newbuf; 2596 xmlChar *newbuf;
2497 size_t size; 2597 size_t size;
2498 2598
2499 size = ctxt->nodemem + len; 2599 size = ctxt->nodemem + len;
2500 size *= 2; 2600 size *= 2;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2584 ret->line = 65535; 2684 ret->line = 65535;
2585 } 2685 }
2586 } 2686 }
2587 if (ctxt->inSubset == 1) { 2687 if (ctxt->inSubset == 1) {
2588 xmlAddChild((xmlNodePtr) ctxt->myDoc->intSubset, ret); 2688 xmlAddChild((xmlNodePtr) ctxt->myDoc->intSubset, ret);
2589 return; 2689 return;
2590 } else if (ctxt->inSubset == 2) { 2690 } else if (ctxt->inSubset == 2) {
2591 xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret); 2691 xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret);
2592 return; 2692 return;
2593 } 2693 }
2594 if ((ctxt->myDoc->children == NULL) || (parent == NULL)) { 2694 if (parent == NULL) {
2595 #ifdef DEBUG_SAX_TREE 2695 #ifdef DEBUG_SAX_TREE
2596 xmlGenericError(xmlGenericErrorContext, 2696 xmlGenericError(xmlGenericErrorContext,
2597 "Setting PI %s as root\n", target); 2697 "Setting PI %s as root\n", target);
2598 #endif 2698 #endif
2599 xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret); 2699 xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret);
2600 return; 2700 return;
2601 } 2701 }
2602 if (parent->type == XML_ELEMENT_NODE) { 2702 if (parent->type == XML_ELEMENT_NODE) {
2603 #ifdef DEBUG_SAX_TREE 2703 #ifdef DEBUG_SAX_TREE
2604 xmlGenericError(xmlGenericErrorContext, 2704 xmlGenericError(xmlGenericErrorContext,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2645 } 2745 }
2646 } 2746 }
2647 2747
2648 if (ctxt->inSubset == 1) { 2748 if (ctxt->inSubset == 1) {
2649 xmlAddChild((xmlNodePtr) ctxt->myDoc->intSubset, ret); 2749 xmlAddChild((xmlNodePtr) ctxt->myDoc->intSubset, ret);
2650 return; 2750 return;
2651 } else if (ctxt->inSubset == 2) { 2751 } else if (ctxt->inSubset == 2) {
2652 xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret); 2752 xmlAddChild((xmlNodePtr) ctxt->myDoc->extSubset, ret);
2653 return; 2753 return;
2654 } 2754 }
2655 if ((ctxt->myDoc->children == NULL) || (parent == NULL)) { 2755 if (parent == NULL) {
2656 #ifdef DEBUG_SAX_TREE 2756 #ifdef DEBUG_SAX_TREE
2657 xmlGenericError(xmlGenericErrorContext, 2757 xmlGenericError(xmlGenericErrorContext,
2658 "Setting xmlSAX2Comment as root\n"); 2758 "Setting xmlSAX2Comment as root\n");
2659 #endif 2759 #endif
2660 xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret); 2760 xmlAddChild((xmlNodePtr) ctxt->myDoc, (xmlNodePtr) ret);
2661 return; 2761 return;
2662 } 2762 }
2663 if (parent->type == XML_ELEMENT_NODE) { 2763 if (parent->type == XML_ELEMENT_NODE) {
2664 #ifdef DEBUG_SAX_TREE 2764 #ifdef DEBUG_SAX_TREE
2665 xmlGenericError(xmlGenericErrorContext, 2765 xmlGenericError(xmlGenericErrorContext,
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
2936 */ 3036 */
2937 void 3037 void
2938 docbDefaultSAXHandlerInit(void) 3038 docbDefaultSAXHandlerInit(void)
2939 { 3039 {
2940 xmlSAX2InitDocbDefaultSAXHandler((xmlSAXHandlerPtr) &docbDefaultSAXHandler); 3040 xmlSAX2InitDocbDefaultSAXHandler((xmlSAXHandlerPtr) &docbDefaultSAXHandler);
2941 } 3041 }
2942 3042
2943 #endif /* LIBXML_DOCB_ENABLED */ 3043 #endif /* LIBXML_DOCB_ENABLED */
2944 #define bottom_SAX2 3044 #define bottom_SAX2
2945 #include "elfgcchack.h" 3045 #include "elfgcchack.h"
OLDNEW
« no previous file with comments | « third_party/libxml/src/SAX.c ('k') | third_party/libxml/src/acconfig.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698