SAX XML Parser-error <STORE> on large xml import
%XML.Reader.OpenFile fails with SAX XML Parser-Error: <STORE> on importing large (1.5 GB) xml file. Any workaround for it?
My goal is one-time import of the file using classes generated by its XML schema.
Comments
One option is to increase $zstorage (see documentation) to let the process use more memory; since it's just a one-time import, this may be simplest. Another option is to set the UsePPGHandler property to true (1) on the instance of %XML.Reader - this has a negative impact on performance.
Thanks, $zstorage worked fine
[edit: moved to Answer rather than comment]
Thanks but I must use xml-to-object classes generated by the xsd
Understand. I haven't tried this myself yet but in theory you should be able to initialize the Reader with an XML.Document object. This Document can be initialized (%OnNew) with a global of your choice in the same manner that TextReader can.
As I see it, xml-to-objects classes need DOM while the whole purpose of TextReaded is to read the xml without DOM creation
Correct. The alternative using TextReader was to "avoid" increasing memory but if you have that option then the answers provided by Timothy are the way to go.
For large files I use %XML.TextReader.ParseFile(). It allows me to pass a "concrete" global instead of using Cache defaults. Usually CacheTemp which is more limited than a concrete global. With this I'm able to process larger files. Granted, it's a little bit of more work (code) as you have to traverse the results (element by element) but it gets the job done.