is it possible to parse large XML files line by line with Natural, kind of like a SAX parser in Java? The only approach I have found (in the documentation and in this forum) is to read the whole (!) XML file into a dynamic variable and call PARSE XML on it (which seems like a DOM parser to me). This works fine for small XML files, but for larger files (the magic file size in our environment seems to be around 30 MB) I get:
NAT1222 Memory required for statement execution not available.
The code I use:
DEFINE WORK FILE 1 #FILENAME TYPE 'UNFORMATTED' READ WORK FILE 1 #XML END-WORK * PARSE XML #XML INTO PATH #XML-PATH NAME #XML-NAME VALUE #XML-VALUE INPUT (AD=IO) #XML-PATH (AL=70) #XML-NAME (AL=70) #XML-VALUE (AL=70) END-PARSE
I already tried reading the work file line by line and calling PARSE XML for each line, but then I get (probably because the XML fragment is not a valid XML document):
0350 NAT8311 Error parsing XML document
Could anyone tell me if it is possible to parse large XML files with Natural?