On 11/02/2012 08:08 AM, Michael Van Canneyt wrote:

There is no attachment to your mail.

The attachment was in my first posting. But just in cease I've attached it again.

Please feel free to check it out.

The example is stripped of most of the xml code that was successfully parsed. This was from about a 5mb stream. I grabbed the xml code surrounding the error position.

Thanks Michael.
program unknown;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes,DOM, XMLRead;

  procedure Test();
  var
    FXMLParser                   : TDOMParser;
    FXMLDocument                 : TXMLDocument;
    FXMLSource                   : TXMLInputSource;
    sData                        : String;
  begin
    sData:=Concat(
      '<?xml version="1.0" encoding="'+
      'UTF-8',  // native platform is LATIN1
      '"?>',
      '<value>',
      '<![CDATA[$B0u testt]]>',
      '</value>'
    );
    sData:=System.AnsiToUtf8(sData);
    FXMLParser:=TDOMParser.Create();
    Try
        FXMLSource:=TXMLInputSource.Create(sData);
        Try
          FXMLParser.Parse(FXMLSource,FXMLDocument);
          Try
          Finally
            FXMLDocument.Free();
          end;
        Finally
          FXMLSource.Free();
        end;

    Finally
      FXMLParser.Free();
    end;
  end;

begin
  Test();
end.

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to