Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How is xml-into used in rpgle xml parser?


Asked by Kimberly Andersen on Dec 15, 2021 XML



XML-INTO is the op-code used to parse the XML document and retrieve the values directly into the variables in RPGLE. Previously I saw many examples using DOM parser but it is complex for any beginners. But IBM introduced XML-INTO op-code and made the XML parsing much easier.
Just so,
Working with XML has never been easier before IBM's introduction of XML-INTO and XML-SAX compatibility to RPGLE. My earlier post did contain detailed info about basics on XML with RPGLE and compatibility of XML-INTO with RPGLE along with its own advantages and disadvantages.
Accordingly, In the past if I need to convert a XML into data in an IBM i file I would use the EDI application to do the conversion. As the XML is so simple I decided to process its contents in my own RPG program. The operation code XML-INTO takes information from elements in the XML document and, in my example, places them into data structure subfields.
Next,
The parser is a SAX (Simple API for XML) parser. A SAX parser operates by reading the XML document character by character.
In respect to this,
The XMLHttpRequest Object has a built in XML Parser. The responseText property returns the response as a string. The responseXML property returns the response as an XML DOM object. If you want to use the response as an XML DOM object, you can use the responseXML property.