RXS_ParseDomToDom()

This subprocedure retrieves a new RXS_ParseDomDS_t data structure from a parent XML structure, allowing you to retrieve and work with a subset of a larger XML document.

Subprocedure Prototype

D RXS_ParseDomToDom...
D                 PR                  Extproc('RXS_ParseDomToDom') Opdesc
D                                     Like(RXS_ParseDomDS_t)

Returns an RXS_ParseDomDS_t which contains information and pointers used by subsequent DOM parsing APIs.

D  XPath                              Like(RXS_Var8Kv_t) Const
D                                     Options(*Varsize)

XPath used to determine which nodes are retrieved into the RXS_ParseDomDS_t return data structure.

D  DS                                 Like(RXS_ParseDomDS_t)
D                                     Options(*Varsize)

RXS_ParseDomDS_t data structure, e.g. the “parent” structure.

Example Code

*--------------------------------------------------------------
* This example demonstrates retrieving a DOM from a specified XPath 
*  and storing it in a RXS_ParseDomDS_t datastructure for further 
*  processing.
* This example uses IBM i 7.1+ prototypes for most calls; refer to
*  the individual documentation for these subprocedures for the 
*  6.1 prototypes.
*--------------------------------------------------------------
H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER)

 /copy QRPGLECPY,RXSCB

D gRootDomDS      DS                  LikeDS(RXS_OpenDomDS_t)
D gBookDomDS      DS                  LikeDS(RXS_ParseDomDS_t)

D gXml            S                   Like(RXS_Var8Kv_t)
D gXPath          S                   Like(RXS_Var1Kv_t)
 /free
  RXS_ResetDS( gRootDomDS : RXS_DS_TYPE_OPENDOM );
  RXS_ResetDS( gBookDomDS : RXS_DS_TYPE_PARSEDOM );

  gXml = RXS_GetStdIn();
  gRootDomDS = RXS_OpenDom( gXml );

  gXPath = RXS_XPath( '/*:bookstore/*:book' );
  gBookDomDS = RXS_ParseDomToDom( gXPath : gRootDomDS );

  *INLR = *ON;
 /end-free

Data Structures

D RXS_ParseDomDS_t...
D                 DS                  Qualified Template Inz
 
D   ReturnedErrorInfo...
D                                     LikeDS(RXS_ReturnedErrorInfoDS_t) Inz
 
D   OnErrorMessageType...
D                               10I 0
 
D   InputCcsid...
D                               10I 0

Specifies the CCSID of the XML being parsed.

D   OutputCcsid...
D                               10I 0

Specifies the CCSID the parsed data will be converted to.

D   Stmf...
D                                     Like(RXS_Var1Kv_t)

Specifies an IFS path to an XML file to parse instead of the Input parm.

D   NodeCount                   10U 0

Contains the current count of XML nodes tracked by this data structure.

D   NodeType                    10I 0
 
D   xmlPtr                        *

Internal use only

D   docPtr                        *

Internal use only

D   contextPtr                    *

Internal use only

D   dictPtr                       *

Internal use only

D   currentPtr                    *

Internal use only

D   parentPtr                     *

Internal use only

D   Reserved                  4096A

Internal use only