midrange.com code scratchpad |
Name:
Alan Cassidy
|
Scriptlanguage:
Plain Text
|
Tabwidth:
4
|
Date:
05/20/2014 04:41:18 pm
|
IP:
Logged
|
|
Description:
This is for the discussion on using XML-INTO for parsing an XML-XLSX file, subject line:
RE: Parsing an XML-XLSX file using XML-INTO
|
Code:
-
- H OPTION( *SRCSTMT )
- * =====================================================================
- D PSDS SDS
- D RowCount 10i 0 overlay( PSDS : 372 )
- * ----------------------------------------------------
- * Data structures for Handler parameters and processing
- D Row ds Qualified Dim( 100 )
- D Cell likeds( Cell_T ) dim( 30 )
- D CountCell 5i 0
- D p_row s *
- * ------------------ -----------------
- D Cell_T ds Dim( 26 ) Qualified
- D data LikeDS( Data_T )
- * ------------------ -----------------
- D Data_T DS Template
- D Type 20a
- D Data 50a
- * ------------------ -----------------
-
- * --------------------------------------------------------------------
- D XPARSE pr ExtPgm( 'XPARSE' )
- D p_fpath 640a
- * ---------------------------------------------------
- D xParse pi
- D filepath 640a
- * ---------------------------------------------------
- D fpath s 640a based( pfpath )
- D rtncode s 10i 0
- D options s 128a
- D xc s 10i 0
- D xr s 10i 0
- *
- /free
- *inlr = *on ;
- //
- pfpath = %addr( filepath ) ;
- %str( pfpath: %size(fpath)) = %trim( filepath ) ;
- //
- /// options = 'countpfx=Count +
- options = 'path=Workbook/Worksheet/Table/Row +
- doc=file +
- datasubf=Data +
- ns=remove +
- case=any +
- trim=all +
- allowextra=yes +
- ' ;
- xml-into row %XML( %str(pfpath) : options );
- //
- dsply ('Processed ' + %char( RowCount ) + ' Rows' ) ;
- //
- for xr = 1 to RowCount ;
- for xc = 1 to Row(xr).CountCell ;
- dsply ('Row ' + %char(xr) + ' Cell ' + %char(xc)
- + ' Data=' ) ;
- dsply ( Row(xr).Cell(xc).Data.Data ) ;
- endfor ;
- endfor ;
- //
-
-
|
|
|