On Thu, Jun 16, 2011 at 9:32 AM, Jeppe Johansen <jepj...@es.aau.dk> wrote: > Den 16-06-2011 14:09, Marcos Douglas skrev: >> >> I am using the xmlread.ReadXMLFile(doc, stream) function to read a XML. >> If I use a file works OK. >> If I use a Stream of the same file (I saved the Stream in a file and >> compare with de original file... are equal), happen an error: >> >> In 'stream:' (line 1 pos 1): Root element is missing > > Do you have an example?
Yes, see: program t_xml; {$mode objfpc}{$H+} uses classes, sysutils, dom, XMLRead; const FILE_NAME = 'test.xml'; var Doc: TXMLDocument; SL: TStringList; m: TMemoryStream; begin ReadXMLFile(Doc, FILE_NAME); //<<<<<<< OK Doc.Free; m := TMemoryStream.Create; SL := TStringList.Create; try SL.LoadFromFile(FILE_NAME); SL.SaveToStream(m); ReadXMLFile(Doc, m); //<<<<<<<< ERROR finally SL.Free; m.Free; end; end. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal