NOTE: The RXS_DOM* APIs were created to allow for a different approach to parsing XML documents. Depending on the complexity of your XML and what data elements you are parsing, the RXS_DOM* APIs can make the syntax for parsing simpler. The simpler syntax comes with a cost because the entire XML document is parsed and stored in memory so you can access any element data at any time (think of it as being able to “CHAIN” to the XML structure - random access). Performance for smaller XML files is comparable for the two XML parsers within RPG-XML Suite, but the larger the XML file the bigger the divide. For example, a large 4MB XML file will take 200 seconds with the event based parser and 600 seconds with the DOM parser. So make sure to factor that into your decision on whether to use the RXS_DOM* APIs to parse or the event based parser.
The following rules apply when specifying non-blank values for either pStartXPath or pEndXPath:
- If pStartXPath is specified as non-blank, although the entire document will be parsed, the building of the DOM will only start when the first instance of that XPath is found.
- If pEndXPath is specified as non-blank and pStartXPath is specified as blank, parsing will stop when the first instance of pEndXPath path is found.
- If pStartXPath is specified as non-blank and pEndXPath is also specified as non-blank, DOM building will start when the first instance of the pStartXPath is found and will stop when the first subsequent instance of pEndXPath is found.
- If pStartXPath is specified as non-blank but pEndXPath is not specified (or is specified as blank), DOM building will start when the first instance of the gStartXPath is found (same as rule 1 above) and will stop when that XML ‘section’ has ended.