# RXS_OpenDom() This subprocedure initializes DOM parsing for a specified chunk of XML. ## Subprocedure Prototype ### IBM i 7.1+ | Field | Description | |---|---| | ` D RXS_OpenDom PR Extproc('RXS_OpenDom') Opdesc D Like(RXS_ParseDOMDS_t)` | Returns an RXS_ParseDOMDS_t which contains information and pointers used by subsequent DOM parsing APIs. | | ` D pXML Like(RXS_Var16Mv_t) Const D Options(*Omit:*Varsize)` | Chunk of XML to be used for subsequent DOM operations. | | ` D pDS LikeDS(RXS_OpenDomDS_t) D Options(*Nopass:*Varsize)` | Holds RXS_OpenDomDS_t used to set up initial DOM parsing options. | ## Example Code ### IBM i 7.1+ #### Example 1 ```rpgle *-------------------------------------------------------------- * This example demonstrates configuring DOM parsing using a RXS_ParseDOMDS_t * datastructure. *-------------------------------------------------------------- H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER) /copy QRPGLECPY,RXSCB D OpenDomDS DS LikeDS(RXS_OpenDOMDS_t) D RootDomDS DS LikeDS(RXS_ParseDOMDS_t) /free RXS_ResetDS( OpenDomDs : RXS_DS_TYPE_OPENDOM ); RXS_ResetDS( RootDomDs : RXS_DS_TYPE_PARSEDOM ); OpenDomDs.InputCcsid = RXS_CCSID_UTF8; RootDomDS = RXS_OpenDom( gXmlResponse : OpenDomDS ); gXPath = RXS_XPath( '/*:Envelope/*:Body/*:FahrenheitToCelsius' + 'Response/*:FahrenheitToCelsiusResult' ); gCelsius = %Dec( RXS_ParseDomToText( gXPath : RootDomDS ) : 11 : 7 ); RXS_CloseDom( RootDomDS ); *INLR = *ON; /end-free ``` ## Data Structures ### RXS_OpenDomDS_t | Field | Description | |---|---| | ` D RXS_OpenDomDS_t... D DS Qualified Template Inz` | | | ` D ReturnedErrorInfo... D LikeDS(RXS_ReturnedErrorInfoDS_t) Inz` | | | ` D DataStructureType... D 5I 0 Inz(RXS_DS_TYPE_OPENDOM)` | **Internal use only** | | ` D OnErrorMessageType... D 5I 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. | ### RXS_ParseDomDS_t | Field | Description | |---|---| | ` 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** |