Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2004-01

A bug in XMLWrite

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Milos Pejovic

Hi All,

I think I found a bug in XMLWrite unit. It doesn't convert '<' and '>' characters in attributes to '&lt;' and '&gt;'.
I haven't read the XML specs, but the browsers (Opera, Mozilla and M$IE) complain when parsing such file.
This is the output of M$IE:

The character '<' cannot be used in an attribute value. Error processing resource 'file:///info.xml'. Line 3, Position 31

<value name="Single" start="<single>" end="</single>" multiple="No"/> ------------------------------^

I use FPC 1.0.10 under Win32.

Cheers,
Milos

Reply by email

Jeff Pohlmeyer
I think I found a bug in XMLWrite unit. It doesn't convert '<' and '>' characters in attributes to '&lt;' and '&gt;'.
program xmlfix;
uses tidy;
procedure fix_xml_file(filename:shortstring);
var
  Doc:tTidy;
  f:text;
  s:ansistring;
begin
  Doc:=tTidy.Create(nil);
  Doc.ErrorFile:=TIDY_NULL_FILE;
  Doc.XmlTags:=True;
  Doc.ParseFile(filename);
  s:=Doc.XML;
  assign(f, filename);
  rewrite(f);
  Write(f, s);
  close(f);
  Doc.Free;
end;
begin
  fix_xml_file('info.xml');
end.

http://www.houston.quik.com/~jkp/tidypas/

__________________________________
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus

Reply by email