Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch errorCode Excluding Merge-Ins
This is equivalent to a diff from 33ee70bd11 to 4751836ea1
2017-11-04
| ||
19:12 | Added a few bench tests to check positional predicate optimization. check-in: e01e949947 user: rolf tags: trunk | |
02:00 | Started implementation of a "keep CDATA sections" switch to [dom parse ...]. check-in: 1cd6dcbed5 user: rolf tags: keepCDATA | |
2017-10-29
| ||
18:34 | Update from trunk. Leaf check-in: 4751836ea1 user: rolf tags: errorCode | |
18:27 | Replaced the (creative) use of encoding identity to make tDOM compatible with the upcoming Tip 345. check-in: 33ee70bd11 user: rolf tags: trunk | |
2017-10-19
| ||
10:40 | Updated tnc to new nmake system check-in: b226917ae3 user: apnadkarni tags: trunk | |
2017-10-01
| ||
01:11 | Musing: Provide useful errorCode information in case of [dom parse ...] error. check-in: 8dd6cf7f01 user: rolf tags: errorCode | |
Changes to generic/tcldom.c.
6544 6544 baseURI, 6545 6545 extResolver, 6546 6546 useForeignDTD, 6547 6547 paramEntityParsing, 6548 6548 interp, 6549 6549 &status); 6550 6550 if (doc == NULL) { 6551 - char s[50]; 6551 + char s[50], linenr[50], columnnr[50]; 6552 6552 long byteIndex, i; 6553 6553 6554 6554 switch (status) { 6555 6555 case TCL_BREAK: 6556 6556 /* Abort of parsing by the application */ 6557 6557 Tcl_ResetResult(interp); 6558 6558 XML_ParserFree(parser); 6559 6559 return TCL_OK; 6560 6560 default: 6561 6561 interpResult = Tcl_GetStringResult(interp); 6562 - sprintf(s, "%ld", XML_GetCurrentLineNumber(parser)); 6562 + sprintf(linenr, "%ld", XML_GetCurrentLineNumber(parser)); 6563 + sprintf(columnnr, "%ld", XML_GetCurrentColumnNumber(parser)); 6563 6564 if (interpResult[0] == '\0') { 6564 6565 /* If the interp result isn't empty, then there was an error 6565 6566 in an enternal entity and the interp result has already the 6566 6567 error msg. If we don't got a document, but interp result is 6567 6568 empty, the error occured in the main document and we 6568 6569 build the error msg as follows. */ 6569 6570 Tcl_AppendResult(interp, "error \"", 6570 6571 XML_ErrorString(XML_GetErrorCode(parser)), 6571 - "\" at line ", s, " character ", NULL); 6572 - sprintf(s, "%ld", XML_GetCurrentColumnNumber(parser)); 6573 - Tcl_AppendResult(interp, s, NULL); 6572 + "\" at line ", linenr, " character ", 6573 + columnnr, NULL); 6574 6574 byteIndex = XML_GetCurrentByteIndex(parser); 6575 6575 if ((byteIndex != -1) && (chan == NULL)) { 6576 6576 Tcl_AppendResult(interp, "\n\"", NULL); 6577 6577 s[1] = '\0'; 6578 6578 for (i=-20; i < 40; i++) { 6579 6579 if ((byteIndex+i)>=0) { 6580 6580 if (xml_string[byteIndex+i]) { ................................................................................ 6586 6586 } else { 6587 6587 break; 6588 6588 } 6589 6589 } 6590 6590 } 6591 6591 Tcl_AppendResult(interp, "\"",NULL); 6592 6592 } 6593 + sprintf(s, "%d", XML_GetErrorCode(parser)); 6594 + Tcl_SetErrorCode(interp, "TDOM", "NOTWELLFORMED", linenr, 6595 + columnnr, s, 6596 + XML_ErrorString(XML_GetErrorCode(parser)), 6597 + NULL); 6593 6598 } else { 6594 6599 if (status == TCL_OK) { 6595 6600 /* For tcl errors (in -externalentitycommand or 6596 6601 * feedback callback) we leave the error msg in 6597 6602 * the interpreter alone. If there wasn't a tcl 6598 6603 * error, there was a parsing error. Because the 6599 6604 * interp has already an error msg, that parsing 6600 6605 * error was in an external entity. Therefore, we 6601 6606 * just add the place of the referencing entity in 6602 6607 * the mail document.*/ 6603 - Tcl_AppendResult(interp, ", referenced at line ", s, NULL); 6604 - sprintf(s, "%ld", XML_GetCurrentColumnNumber(parser)); 6605 - Tcl_AppendResult(interp, " character ", s, NULL); 6608 + Tcl_AppendResult(interp, ", referenced at line ", 6609 + linenr, " character ", columnnr, 6610 + NULL); 6606 6611 } 6607 6612 } 6608 6613 XML_ParserFree(parser); 6609 6614 return TCL_ERROR; 6610 6615 } 6611 6616 } 6612 6617 XML_ParserFree(parser);
Changes to tests/dom.test.
569 569 set result 570 570 } -0.123 571 571 572 572 test dom-2.34 {XML prefix declaration with empty namespace} { 573 573 catch {dom parse {<foo:doc xmlns:foo=""><e1/></foo:doc>}} errMsg 574 574 set errMsg 575 575 } {Missing URI in Namespace declaration, referenced at line 1 character 22} 576 + 577 +test dom-2.34 {errorCode after XML parsing error} { 578 + catch {dom parse "foo"} errMsg catchResult 579 + set errorCode 580 +} {TDOM NOTWELLFORMED 1 0 2 {syntax error}} 576 581 577 582 test dom-3.1 {isName} { 578 583 dom isName ":foo" 579 584 } {1} 580 585 581 586 test dom-3.2 {isName} { 582 587 dom isName "_foo"