# RXS_ParseDomToText() This subprocedure retrieves the text result of a specific XPath. ## Subprocedure Prototype ### IBM i 7.1+ ```rpgle // Returns the text retrieved from the specified XPath. D RXS_ParseDomToText... D PR Extproc('RXS_ParseDomToText') Opdesc D Like(RXS_Var16Mv_t) D Rtnparm // XPath used to determine which nodes are retrieved into the // RXS_ParseDomDS_t return data structure. D XPath Like(RXS_Var8Kv_t) Const D Options(*Varsize) // RXS_ParseDomDS_t data structure, e.g. the "parent" structure. D DS Like(RXS_ParseDomDS_t) D Options(*Varsize) ``` ### IBM i 6.1 ```rpgle D RXS_ParseDomToText... D PR Extproc('RXS_ParseDomToText') Opdesc // Holds the text retrieved from the specified XPath. D Output Like(RXS_Var16Mv_t) D Options(*Varsize) // XPath used to determine which nodes are retrieved into the // RXS_ParseDomDS_t return data structure. D XPath Like(RXS_Var8Kv_t) Const D Options(*Varsize) // RXS_ParseDomDS_t data structure, e.g. the "parent" structure. D DS Like(RXS_ParseDomDS_t) D Options(*Varsize) ``` ## Example Code ### IBM i 7.1+ #### Example 1 ```rpgle *-------------------------------------------------------------- * This example demonstrates retrieving a text value from a specified * XPath and storing it in a character field. * 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 gXml S Like(RXS_Var8Kv_t) D gData S Like(RXS_Var8Kv_t) /free RXS_ResetDS( gRootDomDS : RXS_DS_TYPE_OPENDOM ); gXml = RXS_GetStdIn(); gRootDomDS = RXS_OpenDom( gXml ); gXPath = RXS_XPath( '/*:bookstore/*:book' ); gData = RXS_ParseDomToText( gXPath : gRootDomDS ); *INLR = *ON; /end-free ``` ## Data Structures ### RXS_ParseDomDS_t ```rpgle D RXS_ParseDomDS_t... D DS Qualified Template Inz D ReturnedErrorInfo... D LikeDS(RXS_ReturnedErrorInfoDS_t) Inz D OnErrorMessageType... D 10I 0 // Specifies the CCSID of the XML being parsed. D InputCcsid... D 10I 0 // Specifies the CCSID the parsed data will be converted to. D OutputCcsid... D 10I 0 // Specifies an IFS path to an XML file to parse instead of the Input parm. D Stmf... D Like(RXS_Var1Kv_t) // Contains the current count of XML nodes tracked by this data structure. D NodeCount 10U 0 D NodeType 10I 0 // Internal use only D xml@ * // Internal use only D doc@ * // Internal use only D context@ * // Internal use only D dict@ * // Internal use only D current@ * // Internal use only D parent@ * // Internal use only D Reserved 4096A ```