ARTICLE
iXML Library - Parse
XML data is parsed by a validating XML parser, itself
created using the iXML factory as follows:
DATA(ixml) = cl_ixml=>create( ).
...
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_factory
must 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.
Note
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.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved