Menu

#23 XMLPartner and Delphi 2006

open
nobody
None
5
2013-01-15
2006-02-09
Anonymous
No

Hello !

When I try to use the xmlpartner in Delphi 2006 I've
get an error in the LoadFromMemory function. The same
error in the LoadDataSource.

procedure TForm1.Button2Click(Sender: TObject);
var
tem : TXpObjModel;
s : string;
begin
tem := TXpObjModel.Create(nil);
try
// s := '<?xml version="1.0" encoding="ISO-8859-1"?> ';
s := '<test></test>';
if tem.LoadMemory(s[1],Length(s)) then
ShowMessage('ok')
else
ShowMessage(tem.Errors.Text);
if tem.LoadDataSource('c:\\dec.xml') then
ShowMessage('ok')
else
ShowMessage(tem.Errors.Text);
finally
tem.Free;
end;
end;

The error is : Line 1 Col 2 Error : Invalid XML name: '

Do you have any idea of the cause ?

Tks

Discussion

  • Nobody/Anonymous

    Logged In: NO

    In addition to the *.INC files that need to be modified,
    it appears that there is another issue with some code in
    the parser that is impacted by a change in D2006 (maybe
    earlier, but I only have D6 and D2006). I first noticed
    this in the LoadDataSource. xmlPartner couldn't recognize
    the file as a valid file.

    There are a couple of places where a WideChar is being
    compared to an empty string (''). The variables have been
    set to #0 prior to that and in D6 the comparison "if
    WideChar = '' then...." resolved to true if the wide char
    was set to #0. In D2006, it does not. Not sure what is
    truely correct behaviour, but changing the comparisons to
    widechar = #0 seems to correct the issue.

    I have made the following changes and it seems to have
    resolved this.... However, more testing is probably
    necessary....

    (Based on the 2.57 release.)

    XpChrFlt.pas

    line 640: if FLastChar = #0 then begin
    line 659: if FLastChar = #0 then begin

    XpParser.pas

    line 1916: ParsePCData(TempChar <> #0);
    line 3648: (TempChar = ';') or (TempChar = '/') or
    (TempChar = #0) or {!!.51}{!!.52}

    Hope this helps.

    Best Regards,
    Eric

     
  • Ulrich Herrmann

    Ulrich Herrmann - 2006-02-21

    Logged In: YES
    user_id=683264

    I has the same Problem. It will run fine when you change:
    the some lines in XpChrFlt.pas:
    all where you find: if FLastChar = '' to if FLastChar=#0
    (the lines are 662 and 683)

     
  • Jeroen W. Pluimers

    Logged In: YES
    user_id=244946

    InXpXSLT.inc, also replace this one:

    FGrouping := (FGroupSep <> '') and (FGroupSize > 0);
    into:
    FGrouping := (FGroupSep <> #0) and (FGroupSize >
    0);//##jpl: '' is not a valid WhideChar comparison in D2006
    any more!

    --jeroen

     

Log in to post a comment.

MongoDB Logo MongoDB