iXML Library - Parsing
XML data is parsed by a validating XML parser, itself created using the iXML factory as follows:
DATA(parser) = ixml->create_parser(
istream = ...
document = ...
stream_factory = ... ).
The static type of the reference variable
parser is then the interface IF_IXML_PARSER. The parser requires the following input parameters:
- The input stream
istream(to be parsed).
- An XML document
document, to which the stream is parsed.
- A factory
stream_factorymust be specified. This enables the parser to create appropriate streams if external sources are addressed in the parsed document.
A parser created in this way works like an iterator on the input stream. XML data can be parsed to a DOM representation in a single action or sequential parsing can be used, where the parser stops after certain steps and passes control to the application.
Alongside the parsers created using CREATE_PARSER, the factory method CREATE_TOKEN_PARSER can be used to create a token parser for direct parsing to ABAP data objects.
7.31 | 7.40 | 7.54
A parser is only valid once for the associated input stream and the associated XML document. Once it has parsed the input stream to a document, the parser can be passed to the garbage collector. A parser cannot be reused for the same XML data or for any other data.