View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003332 | JEDI VCL | 00 JVCL Components | public | 2005-11-30 02:31 | 2005-12-03 04:23 |
Reporter | Christer Fahlgren | Assigned To | elahn | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | duplicate | ||
Product Version | 3.00 | ||||
Target Version | Fixed in Version | ||||
Summary | 0003332: TJvSimpleXMLElemText.LoadFromStream doesn't preserve whitespace. | ||||
Description | When loading an XML element from file like <text>Hi three spaces</text> it is read as <text>Hi three whitespaces</text> stripping the extra spaces. According to the XML gurus I know (I am not an XML guru :-)) this whitespace should be preserved when reading a text element. I would prefer no stripping of whitespaces at all for text elements. Potentially add an option to strip. Note that the stripping is also very inconsistent - not stripping other whitespace such as tab, cr and lf. If you strip - strip it all off. My proposal is to preserve white space as default and that this is what should be checked in. I believe my proposal is backed up by the statements here: http://www.w3.org/TR/REC-xml/#charsets procedure TJvSimpleXMLElemText.LoadFromStream(const Stream: TStream; Parent: TJvSimpleXML); var I, lStreamPos, Count: Integer; lBuf: array [0..cBufferSize - 1] of Char; St: string; begin lStreamPos := Stream.Position; St := ''; repeat Count := Stream.Read(lBuf, SizeOf(lBuf)); if Parent <> nil then Parent.DoLoadProgress(Stream.Position, Stream.Size); for I := 0 to Count - 1 do begin //Increment Stream pos for after comment Inc(lStreamPos); case lBuf[I] of '<': begin //Quit text Dec(lStreamPos); Count := 0; Break; end; else begin St := St + lBuf[I]; end; end; end; until Count = 0; if GetSimpleXML <> nil then GetSimpleXML.DoDecodeValue(St); Value := St; Name := ''; if Parent <> nil then Parent.DoValueParsed('', St); Stream.Seek(lStreamPos, soFromBeginning); end; Best regards, Christer | ||||
Tags | No tags attached. | ||||
|
Note that in my example above the tree spaces was stripped! This is how it should be interpreted: <text>Hi three___spaces</text> it is read as <text>Hi three_whitespaces</text> substitute the _ for a space. /Christer |
|
I'm not sure I follow, as I use TJvSimpleXML extensively and whitespace is never stripped... Use the daily snapshots from here: http://jvcl.sf.net/daily/ And tell us if that still happens. If it does, please post a simple example program and XML file that produces the bug. Please zip it up, including only the .dpr, .pas, .dfm & .xml files. |
|
Yes you are right, I am using 3.00 and this is fixed in the daily build. This is a duplicate of issue http://homepages.borland.com/jedi/issuetracker/view.php?id=2822 Sorry for filing an issue about an already fixed bug! Best regards, Christer |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-11-30 02:31 | Christer Fahlgren | New Issue | |
2005-11-30 02:34 | Christer Fahlgren | Note Added: 0008178 | |
2005-12-02 18:33 | elahn | Note Added: 0008191 | |
2005-12-02 18:33 | elahn | Status | new => feedback |
2005-12-03 03:34 | Christer Fahlgren | Note Added: 0008193 | |
2005-12-03 04:23 | elahn | Relationship added | duplicate of 0002822 |
2005-12-03 04:23 | elahn | Duplicate ID | 0 => 2822 |
2005-12-03 04:23 | elahn | Status | feedback => resolved |
2005-12-03 04:23 | elahn | Resolution | open => duplicate |
2005-12-03 04:23 | elahn | Assigned To | => elahn |