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
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
....
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
|
baseURI, extResolver, useForeignDTD, paramEntityParsing, interp, &status); if (doc == NULL) { char s[50]; long byteIndex, i; switch (status) { case TCL_BREAK: /* Abort of parsing by the application */ Tcl_ResetResult(interp); XML_ParserFree(parser); return TCL_OK; default: interpResult = Tcl_GetStringResult(interp); sprintf(s, "%ld", XML_GetCurrentLineNumber(parser)); if (interpResult[0] == '\0') { /* If the interp result isn't empty, then there was an error in an enternal entity and the interp result has already the error msg. If we don't got a document, but interp result is empty, the error occured in the main document and we build the error msg as follows. */ Tcl_AppendResult(interp, "error \"", XML_ErrorString(XML_GetErrorCode(parser)), "\" at line ", s, " character ", NULL); sprintf(s, "%ld", XML_GetCurrentColumnNumber(parser)); Tcl_AppendResult(interp, s, NULL); byteIndex = XML_GetCurrentByteIndex(parser); if ((byteIndex != -1) && (chan == NULL)) { Tcl_AppendResult(interp, "\n\"", NULL); s[1] = '\0'; for (i=-20; i < 40; i++) { if ((byteIndex+i)>=0) { if (xml_string[byteIndex+i]) { ................................................................................ } else { break; } } } Tcl_AppendResult(interp, "\"",NULL); } } else { if (status == TCL_OK) { /* For tcl errors (in -externalentitycommand or * feedback callback) we leave the error msg in * the interpreter alone. If there wasn't a tcl * error, there was a parsing error. Because the * interp has already an error msg, that parsing * error was in an external entity. Therefore, we * just add the place of the referencing entity in * the mail document.*/ Tcl_AppendResult(interp, ", referenced at line ", s, NULL); sprintf(s, "%ld", XML_GetCurrentColumnNumber(parser)); Tcl_AppendResult(interp, " character ", s, NULL); } } XML_ParserFree(parser); return TCL_ERROR; } } XML_ParserFree(parser); |
|
|
>
|
|
<
>
>
>
>
>
|
|
|
|
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
....
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
|
baseURI, extResolver, useForeignDTD, paramEntityParsing, interp, &status); if (doc == NULL) { char s[50], linenr[50], columnnr[50]; long byteIndex, i; switch (status) { case TCL_BREAK: /* Abort of parsing by the application */ Tcl_ResetResult(interp); XML_ParserFree(parser); return TCL_OK; default: interpResult = Tcl_GetStringResult(interp); sprintf(linenr, "%ld", XML_GetCurrentLineNumber(parser)); sprintf(columnnr, "%ld", XML_GetCurrentColumnNumber(parser)); if (interpResult[0] == '\0') { /* If the interp result isn't empty, then there was an error in an enternal entity and the interp result has already the error msg. If we don't got a document, but interp result is empty, the error occured in the main document and we build the error msg as follows. */ Tcl_AppendResult(interp, "error \"", XML_ErrorString(XML_GetErrorCode(parser)), "\" at line ", linenr, " character ", columnnr, NULL); byteIndex = XML_GetCurrentByteIndex(parser); if ((byteIndex != -1) && (chan == NULL)) { Tcl_AppendResult(interp, "\n\"", NULL); s[1] = '\0'; for (i=-20; i < 40; i++) { if ((byteIndex+i)>=0) { if (xml_string[byteIndex+i]) { ................................................................................ } else { break; } } } Tcl_AppendResult(interp, "\"",NULL); } sprintf(s, "%d", XML_GetErrorCode(parser)); Tcl_SetErrorCode(interp, "TDOM", "NOTWELLFORMED", linenr, columnnr, s, XML_ErrorString(XML_GetErrorCode(parser)), NULL); } else { if (status == TCL_OK) { /* For tcl errors (in -externalentitycommand or * feedback callback) we leave the error msg in * the interpreter alone. If there wasn't a tcl * error, there was a parsing error. Because the * interp has already an error msg, that parsing * error was in an external entity. Therefore, we * just add the place of the referencing entity in * the mail document.*/ Tcl_AppendResult(interp, ", referenced at line ", linenr, " character ", columnnr, NULL); } } XML_ParserFree(parser); return TCL_ERROR; } } XML_ParserFree(parser); |
Changes to tests/dom.test.
569 570 571 572 573 574 575 576 577 578 579 580 581 582 |
set result } -0.123 test dom-2.34 {XML prefix declaration with empty namespace} { catch {dom parse {<foo:doc xmlns:foo=""><e1/></foo:doc>}} errMsg set errMsg } {Missing URI in Namespace declaration, referenced at line 1 character 22} test dom-3.1 {isName} { dom isName ":foo" } {1} test dom-3.2 {isName} { dom isName "_foo" |
> > > > > |
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 |
set result } -0.123 test dom-2.34 {XML prefix declaration with empty namespace} { catch {dom parse {<foo:doc xmlns:foo=""><e1/></foo:doc>}} errMsg set errMsg } {Missing URI in Namespace declaration, referenced at line 1 character 22} test dom-2.34 {errorCode after XML parsing error} { catch {dom parse "foo"} errMsg catchResult set errorCode } {TDOM NOTWELLFORMED 1 0 2 {syntax error}} test dom-3.1 {isName} { dom isName ":foo" } {1} test dom-3.2 {isName} { dom isName "_foo" |