RXS_Validate()

This subprocedure performs validation options on a given character string.

Currently it can perform XSD validation against XML.

Subprocedure Prototype

D RXS_Validate...
D                 PR              N   Extproc('RXS_Validate') Opdesc
 
D  pData                              Like(RXS_Var16Mv_t)
D                                     Options(*Omit: *Varsize) Const

Character data to be validated.

D  pDS                                Like(RXS_Var64K_t)
D                                     Options(*Varsize)

This field can contain either an RXS_XsdValidationDS_t data structure, or the XSD stored in a character field.

Example Code

*--------------------------------------------------------------
* This example code validates XML data against a specified XSD.
*--------------------------------------------------------------
H DFTACTGRP(*NO) BNDDIR('RXSBND') ACTGRP(*CALLER)

 /copy QRPGLECPY,RXSCB

D XsdValidateDS...
D                 DS                  LikeDS(RXS_XsdValidationDS_t)
D                                     Inz(*LikeDS)
D goodXml         S                   Like(RXS_Var64Kv_t)
 /free
  // This example assumes that goodXml contains XML data.
  //  This data could be retrieved from RXS_GetStdIn(), or composed
  //  using the RXS composition engine.

  RXS_ResetDS( XsdValidateDS : RXS_DS_TYPE_XSDVALIDATION );
  XsdValidateDS.XsdLocation =
  'http://files.rpg-xml.com/example/xsdvalidate/validate.xsd';
  if RXS_Validate( goodXml : XsdValidateDS );
    RXS_JobLog( 'XML 1 Validated successfully');
  else;
    RXS_JobLog( 'XML 1 Validation failed');
    RXS_JobLog( 'Validation Error #%s: %s' :
      %Char( XsdValidateDS.ValidationErrorCode ) :
      XsdValidateDS.ValidationErrorText );
  endif;

  *INLR = *ON;
 /end-free

Data Structures

D RXS_XsdValidationDS_t...
D                 DS                  Qualified Template Inz
 
D   ReturnedErrorInfo...
D                                     LikeDS(RXS_ReturnedErrorInfoDS_t) Inz
 
D   OnErrorMessageType...
D                               10I 0
 
D   XsdLocation...
D                                     Like(RXS_Var1Kv_t)

The IFS path or URI where the XSD is located.

D   ValidationErrorCode...
D                               10I 0

Error code returned by the validation operation.

D   ValidationErrorText...
D                                     Like(RXS_Var1Kv_t)

Error message returned by the validation operation.

D   XsdCcsid                    10I 0

CCSID of the XSD data.

D   XsdPointer                    *

Internal use only

D   XsdLength                   10I 0

Internal use only

D   XmlCcsid                    10I 0

The CCSID of the XML data.

D   XmlPointer                    *

Internal use only

D   XmlLength                   10I 0

Internal use only

D   Reserved                  4096A

Internal use only