1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-23 17:33:50 +03:00

Fixed some wrongly space collapsing code due to misreading of the spec, Daniel.

This commit is contained in:
Daniel Veillard 1999-11-18 14:02:05 +00:00
parent 7f8585025f
commit 07136650c1
8 changed files with 28 additions and 23 deletions

View File

@ -1,4 +1,10 @@
Wed Nov 17 18:28:06 CET 1999
Thu Nov 18 14:57:18 CET 1999
* parser.c: Fixed some wrongly space collapsing code due to
a misreading of the spec.
* result/*: fixed the output accordingly
Wed Nov 17 18:28:06 CET 1999 Daniel Veillard <Daniel.Veillard@w3.org>
* encoding.c: bug fix and typos
* xmlIO.[ch] parser.c: first bits toward real progressive parsing

View File

@ -1,5 +1,5 @@
SAX.setDocumentLocator()
SAX.startDocument()
SAX.startElement(doc, attr='to normalize with a space')
SAX.startElement(doc, attr='to normalize with a space')
SAX.endElement(doc)
SAX.endDocument()

View File

@ -1,5 +1,5 @@
SAX.setDocumentLocator()
SAX.startDocument()
SAX.startElement(doc, attr='to normalize with a space')
SAX.startElement(doc, attr='to normalize with a space')
SAX.endElement(doc)
SAX.endDocument()

View File

@ -2509,6 +2509,12 @@ xmlParseEntityValue(xmlParserCtxtPtr ctxt, xmlChar **orig) {
* #x20 is appended for a "#xD#xA" sequence that is part of an external
* parsed entity or the literal entity value of an internal parsed entity
* - other characters are processed by appending them to the normalized value
* If the declared value is not CDATA, then the XML processor must further
* process the normalized attribute value by discarding any leading and
* trailing space (#x20) characters, and by replacing sequences of space
* (#x20) characters by a single space (#x20) character.
* All attributes for which no declaration has been read should be treated
* by a non-validating parser as if declared CDATA.
*
* Returns the AttValue parsed or NULL. The value has to be freed by the caller.
*/
@ -2523,7 +2529,6 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) {
xmlChar *current = NULL;
xmlEntityPtr ent;
xmlChar cur;
int blank = 0;
SHRINK;
@ -2564,7 +2569,6 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) {
if ((cur == '&') && (NXT(1) == '#')) {
int val = xmlParseCharRef(ctxt);
*out++ = val;
blank = 0;
} else if (cur == '&') {
ent = xmlParseEntityRef(ctxt);
if ((ent != NULL) &&
@ -2594,20 +2598,16 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) {
*out++ = *cur++;
*out++ = ';';
}
blank = 0;
} else {
/* invalid for UTF-8 , use COPY(out); !!!!!! */
if ((cur == 0x20) || (cur == 0xD) || (cur == 0xA) || (cur == 0x9)) {
if (!blank) {
*out++ = 0x20;
if (out - buffer > buffer_size - 10) {
int index = out - buffer;
growBuffer(buffer);
out = &buffer[index];
}
*out++ = 0x20;
if (out - buffer > buffer_size - 10) {
int index = out - buffer;
growBuffer(buffer);
out = &buffer[index];
}
blank = 1;
} else {
*out++ = cur;
if (out - buffer > buffer_size - 10) {
@ -2616,7 +2616,6 @@ xmlParseAttValue(xmlParserCtxtPtr ctxt) {
growBuffer(buffer);
out = &buffer[index];
}
blank = 0;
}
NEXT;
}

View File

@ -2,9 +2,9 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG April 1999//EN" "http://www.w3.org/Graphics/SVG/svg-19990412.dtd">
<svg width="800px" height="800px">
<desc>This sample SVG file draws a flower</desc>
<g style="transform: matrix(1 0 0 -1 -25.88 798.60); stroke: #000; stroke-width: 1">
<path style="fill: #1A5466" d="m 242.33 684.19 C 346.44 757.48 271.45 647.38 213.17 641.37 C 271.45 647.38 383.43 575.21 256.71 613.30 C 383.43 575.21 251.04 565.90 205.23 609.68 C 251.04 565.90 265.13 432.88 210.71 557.95 C 265.13 432.88 175.04 531.37 175.67 596.26 C 175.04 531.37 80.63 437.67 138.96 559.82 C 80.63 437.67 100.67 569.80 146.75 611.20 C 100.67 569.80 -31.14 585.98 95.49 617.49 C -31.14 585.98 83.94 652.25 140.24 643.26 C 83.94 652.25 13.98 766.12 113.04 687.55 C 13.98 766.12 137.45 716.63 161.05 668.30 C 137.45 716.63 182.02 842.45 178.39 717.23 C 182.02 842.45 220.90 714.46 193.51 667.46 C 220.90 714.46 346.44 757.48 242.33 684.19 z"/>
<path style="fill: #34AACD" d="M 235.33 691.19 C 339.44 764.48 264.45 654.38 206.17 648.37 C 264.45 654.38 376.43 582.21 249.71 620.30 C 376.43 582.21 244.04 572.90 198.23 616.68 C 244.04 572.90 258.13 439.88 203.71 564.95 C 258.13 439.88 168.04 538.37 168.67 603.26 C 168.04 538.37 73.63 444.67 131.96 566.82 C 73.63 444.67 93.67 576.80 139.75 618.20 C 93.67 576.80 -38.14 592.98 88.49 624.49 C -38.14 592.98 76.94 659.25 133.24 650.26 C 76.94 659.25 6.98 773.12 106.04 694.55 C 6.98 773.12 130.45 723.63 154.05 675.30 C 130.45 723.63 175.02 849.45 171.39 724.23 C 175.02 849.45 213.90 721.46 186.51 674.46 C 213.90 721.46 339.44 764.48 235.33 691.19 z"/>
<path style="fill: #F881BF" d="M 199.44 634.43 C 199.44 622.16 189.19 612.21 176.54 612.21 C 163.89 612.21 153.63 622.16 153.63 634.43 C 153.63 646.71 163.89 656.66 176.54 656.66 C 189.19 656.66 199.44 646.71 199.44 634.43 z"/>
<g style="transform: matrix(1 0 0 -1 -25.88 798.60); stroke: #000; stroke-width: 1">
<path style="fill: #1A5466" d="m 242.33 684.19 C 346.44 757.48 271.45 647.38 213.17 641.37 C 271.45 647.38 383.43 575.21 256.71 613.30 C 383.43 575.21 251.04 565.90 205.23 609.68 C 251.04 565.90 265.13 432.88 210.71 557.95 C 265.13 432.88 175.04 531.37 175.67 596.26 C 175.04 531.37 80.63 437.67 138.96 559.82 C 80.63 437.67 100.67 569.80 146.75 611.20 C 100.67 569.80 -31.14 585.98 95.49 617.49 C -31.14 585.98 83.94 652.25 140.24 643.26 C 83.94 652.25 13.98 766.12 113.04 687.55 C 13.98 766.12 137.45 716.63 161.05 668.30 C 137.45 716.63 182.02 842.45 178.39 717.23 C 182.02 842.45 220.90 714.46 193.51 667.46 C 220.90 714.46 346.44 757.48 242.33 684.19 z"/>
<path style="fill: #34AACD" d="M 235.33 691.19 C 339.44 764.48 264.45 654.38 206.17 648.37 C 264.45 654.38 376.43 582.21 249.71 620.30 C 376.43 582.21 244.04 572.90 198.23 616.68 C 244.04 572.90 258.13 439.88 203.71 564.95 C 258.13 439.88 168.04 538.37 168.67 603.26 C 168.04 538.37 73.63 444.67 131.96 566.82 C 73.63 444.67 93.67 576.80 139.75 618.20 C 93.67 576.80 -38.14 592.98 88.49 624.49 C -38.14 592.98 76.94 659.25 133.24 650.26 C 76.94 659.25 6.98 773.12 106.04 694.55 C 6.98 773.12 130.45 723.63 154.05 675.30 C 130.45 723.63 175.02 849.45 171.39 724.23 C 175.02 849.45 213.90 721.46 186.51 674.46 C 213.90 721.46 339.44 764.48 235.33 691.19 z"/>
<path style="fill: #F881BF" d="M 199.44 634.43 C 199.44 622.16 189.19 612.21 176.54 612.21 C 163.89 612.21 153.63 622.16 153.63 634.43 C 153.63 646.71 163.89 656.66 176.54 656.66 C 189.19 656.66 199.44 646.71 199.44 634.43 z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -3,7 +3,7 @@
<svg width="4in" height="3in">
<defs>
<symbol id="Triangle1" min-x="0" min-y="0" max-x="300" max-y="200">
<path d="M 50 0 L 50 200 L 250 0 z"/>
<path d="M 50 0 L 50 200 L 250 0 z"/>
</symbol>
<symbol id="Triangle2" min-x="0" min-y="0" max-x="300" max-y="200">
<path d="M 50 0 L 250 200 L 250 0 z"/>

Before

Width:  |  Height:  |  Size: 847 B

After

Width:  |  Height:  |  Size: 848 B

View File

@ -1,2 +1,2 @@
<?xml version="1.0"?>
<doc attr="to normalize with a space"/>
<doc attr="to normalize with a space"/>

View File

@ -1,2 +1,2 @@
<?xml version="1.0"?>
<doc attr="to normalize with a space"/>
<doc attr="to normalize with a space"/>