View Issue Details

IDProjectCategoryView StatusLast Update
0002822JEDI VCL00 JVCL Componentspublic2005-05-17 13:36
ReporteranonymousAssigned Tojfudickar 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version3.00 
Summary0002822: TJvAppXMLFileStorage.ReadString bug if string containsLineFeed characters
DescriptionBUG: When the string to read contains linefeed chars (0000013#10),
      the leading whitespace is trimmed.

EXAMPLE:

var MULTILINE_STRING: string = 'line1 ' + 0000013#10 +
                               ' level1' + 0000013#10 +
                               ' level2' + 0000013#10;

procedure test(aStorage: TJvAppXMLFileStorage);
begin
  aStorage.WriteString('path', MULTILINE_STRING);
  aStorage.Reload;
  ShowMessage(aStorage.ReadString('path',''));
end;

Result: You should see the messagebox showing 2. and 3. lines with
wrong indents.(May this be the underlying XML component's bug)
TagsNo tags attached.

Relationships

has duplicate 0003332 resolvedelahn TJvSimpleXMLElemText.LoadFromStream doesn't preserve whitespace. 

Activities

muk

2005-04-19 07:35

reporter   ~0007029

Nobody could reproduce ???

2005-04-28 19:06

 

JvXmlStorageWS_BUG.zip (3,987 bytes)

muk

2005-04-28 19:09

reporter   ~0007082

Attached a sample...

jfudickar

2005-05-02 13:38

developer   ~0007101

Hi,

i've looked into it now. But i didn't know why this is so implemented.

It's in the TJvSimpleXMLElemText.LoadFromStream

The problem is the following Case statement:

      case lBuf[I] of
        '<':
          begin
            //Quit text
            Dec(lStreamPos);
            Count := 0;
            Break;
          end;
        ' ':
          if lPos = 0 then
          begin
            Inc(lPos);
            St := St + ' ';
          end;
      else
        begin
          lPos := 0;
          St := St + lBuf[I];
        end;
      end;

All multiple blanks will be reduced to one blank. THis is not a problem of the start of line.

I didn't know, if this is a special requirement of xml.

Any further comments are welcome.

Greetings
Jens

muk

2005-05-02 19:01

reporter   ~0007103

Neither do I know about standart way of whitespace handling in XML, but
IMHO TJvAppXMLFileStorage must be consistent.

For a quick fix, I check the string for CR/LF and use WriteStrings if so.

muk

2005-05-02 19:02

reporter   ~0007104

By the way for XML standartization:
http://www.ucc.ie/xml/#space

jfudickar

2005-05-05 01:18

developer   ~0007109

Fixed in CVS.

Please give it a try.

muk

2005-05-17 13:16

reporter   ~0007171

It seems OK now.

Sorry it' s a bit late, I forgot to answer. The case well may be closed.

Issue History

Date Modified Username Field Change
2005-03-30 12:54 anonymous New Issue
2005-04-19 07:35 muk Note Added: 0007029
2005-04-28 19:06 muk File Added: JvXmlStorageWS_BUG.zip
2005-04-28 19:09 muk Note Added: 0007082
2005-05-02 13:38 jfudickar Note Added: 0007101
2005-05-02 19:01 muk Note Added: 0007103
2005-05-02 19:02 muk Note Added: 0007104
2005-05-05 01:18 jfudickar Note Added: 0007109
2005-05-05 01:18 jfudickar Assigned To => jfudickar
2005-05-05 01:18 jfudickar Status new => feedback
2005-05-17 13:16 muk Note Added: 0007171
2005-05-17 13:36 jfudickar Status feedback => resolved
2005-05-17 13:36 jfudickar Fixed in Version => 3.00
2005-05-17 13:36 jfudickar Resolution open => fixed
2005-12-03 04:23 elahn Relationship added has duplicate 0003332