[fpc-devel] XML Stream capacity

2010-01-14 Thread Leonardo M . Ramé
I'm using fcl-xml to parse a XML data from a TMemoryStream/TStringStream and 
noted it can parse streams with a maximum capacity of 4096 bytes, why can't it 
receive bigger streams?.

The maximum capacity is defined in the constructor of TXMLStreamInputSource, in 
XMLRead.pp.

---
constructor TXMLStreamInputSource.Create(AStream: TStream; AOwnStream: Boolean);
begin
  FStream := AStream;
  FCapacity := 4096; -- here's the max capacity allowed
  ...
---

My testing code is this:

var
  lDoc: TXMLDocument;
  lStr: TStringStream;
begin
  lStr := TStringStream.Create(Memo1.Text);
  lDoc := TXMLDocument.Create;
  try
ReadXMLFile(lDoc, lStr);
  finally
lDoc.Free;
lStr.Free;
  end;
end.

Leonardo M. Ramé
http://leonardorame.blogspot.com



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


Re: [fpc-devel] XML Stream capacity

2010-01-14 Thread Sergei Gorelkin

Leonardo M. Ramé wrote:

I'm using fcl-xml to parse a XML data from a TMemoryStream/TStringStream and 
noted it can parse streams with a maximum capacity of 4096 bytes, why can't it 
receive bigger streams?.

The maximum capacity is defined in the constructor of TXMLStreamInputSource, in 
XMLRead.pp.

This value has nothing to do with total possible stream size, it is only the size of buffer used 
while reading.
The maximum size of XML data that can be read with DOM on a 32-bit machine is about 40 to 150 MBytes 
(depending on the data structure).


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


Re: [fpc-devel] XML Stream capacity

2010-01-14 Thread Leonardo M . Ramé
Thanks Sergey.

I tought that was why my program was stopping with an assertion in procedure 
TNodePool.AddExtent of dom.pp, the assertion dissapears when I work with 
smaller XML files.

BTW: the file worked with older versions of fcl-xml, now I'm using the trunk 
version because it no longer deppends on AVL_Tree, that wasn'n thread safe.

I attached the file I'm using for testing.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Thu, 1/14/10, Sergei Gorelkin sergei_gorel...@mail.ru wrote:

 From: Sergei Gorelkin sergei_gorel...@mail.ru
 Subject: Re: [fpc-devel] XML Stream capacity
 To: FPC developers' list fpc-devel@lists.freepascal.org
 Date: Thursday, January 14, 2010, 12:51 PM
 Leonardo M. Ramé wrote:
  I'm using fcl-xml to parse a XML data from a
 TMemoryStream/TStringStream and noted it can parse streams
 with a maximum capacity of 4096 bytes, why can't it receive
 bigger streams?.
  
  The maximum capacity is defined in the constructor of
 TXMLStreamInputSource, in XMLRead.pp.
  
 This value has nothing to do with total possible stream
 size, it is only the size of buffer used while reading.
 The maximum size of XML data that can be read with DOM on a
 32-bit machine is about 40 to 150 MBytes (depending on the
 data structure).
 
 Sergei
 ___
 fpc-devel maillist  -  fpc-devel@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-devel



  ?xml version=1.0?
HISRISSolExa
CodTurno283355/CodTurno
FechaDesde2009-10-15 08:20:00/FechaDesde
FechaHasta2009-10-15 08:39:00/FechaHasta
TipoIngresoA/TipoIngreso
Equipo
NombreMAMCH22S - ELSCINT/Nombre
ModalidadCR/Modalidad
/Equipo
Especialidad![CDATA[MAMOGRAFIA]]/Especialidad
Paciente
NroFcr18682009/NroFcr
SexoU/Sexo
Nombres![CDATA[GRACIELA]]/Nombres
ApellidoPaterno![CDATA[MORO]]/ApellidoPaterno
FechaNacimiento1947-08-04/FechaNacimiento
Domicilio![CDATA[25 DE MAYO 154]]/Domicilio
Telefono![CDATA[4881137 ]]/Telefono
TipoDocumentoD.N.I./TipoDocumento
NroDocumento18682009/NroDocumento
/Paciente
FinanciadorPlan
Financiador![CDATA[APROSS   ]]/Financiador
/FinanciadorPlan
ProfesionalDeriva
Nombres![CDATA[VALDEZ CARLOS]]/Nombres
ApellidoPaterno![CDATA[SICCHAR]]/ApellidoPaterno
/ProfesionalDeriva
Prestaciones
Prestacion
Cantidad2/Cantidad
Prestacion![CDATA[MAMOGRAFIA UNILATERAL F Y P]]/Prestacion
Codigo340601/Codigo
/Prestacion
/Prestaciones
FechaCompromiso2009-10-17 08:20:00/FechaCompromiso
/HISRISSolExa

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


Re: [fpc-devel] XML Stream capacity

2010-01-14 Thread Sergei Gorelkin

Leonardo M. Ramé wrote:

Thanks Sergey.

I tought that was why my program was stopping with an assertion in procedure 
TNodePool.AddExtent of dom.pp, the assertion dissapears when I work with 
smaller XML files.

BTW: the file worked with older versions of fcl-xml, now I'm using the trunk 
version because it no longer deppends on AVL_Tree, that wasn'n thread safe.

I attached the file I'm using for testing.


Does r14644 solve the problem?

Sergei

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


Re: [fpc-devel] XML Stream capacity

2010-01-14 Thread Leonardo M . Ramé
Yes!, thank you very much Sergei.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Thu, 1/14/10, Sergei Gorelkin sergei_gorel...@mail.ru wrote:

 From: Sergei Gorelkin sergei_gorel...@mail.ru
 Subject: Re: [fpc-devel] XML Stream capacity
 To: FPC developers' list fpc-devel@lists.freepascal.org
 Date: Thursday, January 14, 2010, 2:24 PM
 Leonardo M. Ramé wrote:
  Thanks Sergey.
  
  I tought that was why my program was stopping with an
 assertion in procedure TNodePool.AddExtent of dom.pp, the
 assertion dissapears when I work with smaller XML files.
  
  BTW: the file worked with older versions of fcl-xml,
 now I'm using the trunk version because it no longer
 deppends on AVL_Tree, that wasn'n thread safe.
  
  I attached the file I'm using for testing.
  
 Does r14644 solve the problem?
 
 Sergei
 
 ___
 fpc-devel maillist  -  fpc-devel@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-devel
 



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