Para validar um XML no progress basta utilizar o READ-XML aplicando um XSD.

Exemplos utilizados

Pessoa.xml

Pessoa.xsd


Validação do XML


DEFINE VARIABLE cSourceType AS CHARACTER NO-UNDO.
DEFINE VARIABLE cReadMode AS CHARACTER NO-UNDO.
DEFINE VARIABLE lOverrideDefaultMapping AS LOGICAL NO-UNDO.
DEFINE VARIABLE cFile AS CHARACTER NO-UNDO.
DEFINE VARIABLE cEncoding AS CHARACTER NO-UNDO.
DEFINE VARIABLE cSchemaLocation AS CHARACTER NO-UNDO.
DEFINE VARIABLE cFieldTypeMapping AS CHARACTER NO-UNDO.
DEFINE VARIABLE cVerifySchemaMode AS CHARACTER NO-UNDO.
DEFINE VARIABLE retOK AS LOGICAL NO-UNDO.
DEFINE VARIABLE httPessoa AS HANDLE NO-UNDO.
DEFINE VARIABLE i_campos AS INTEGER.
DEFINE VARIABLE bh                       AS HANDLE    NO-UNDO.
DEFINE VARIABLE qh                       AS HANDLE    NO-UNDO.
DEFINE VARIABLE fld1                     AS HANDLE    NO-UNDO.

CREATE TEMP-TABLE httPessoa.

ASSIGN
cSourceType = “file”
cFile = “pessoa.xml”
cReadMode = “empty”
cSchemaLocation = “pessoa.xsd”
lOverrideDefaultMapping = ?
cFieldTypeMapping = ?
cVerifySchemaMode = ?.

retOK = httPessoa:READ-XML(cSourceType,
cFile,
cReadMode,
cSchemaLocation,
lOverrideDefaultMapping,
cFieldTypeMapping,
cVerifySchemaMode).

bh = httPessoa:DEFAULT-BUFFER-HANDLE.

CREATE QUERY qh.
qh:SET-BUFFERS(bh).
qh:QUERY-PREPARE(“for each ” + bh:Table).
qh:QUERY-OPEN().

REPEAT:
qh:GET-NEXT().
IF qh:QUERY-OFF-END THEN LEAVE.

Do i_campos = 1 To bh:Num-fields:
fld1 = bh:BUFFER-FIELD(i_campos).
MESSAGE bh:BUFFER-FIELD(i_campos):name
fld1:BUFFER-VALUE() VIEW-AS ALERT-BOX.
END.
END.

qh:QUERY-CLOSE().
bh:BUFFER-RELEASE().

DELETE OBJECT httPessoa.
DELETE OBJECT qh.

flw