XML PARSE
| COBOL | JAVA |
| XML PARSE | xmlParse xmlParseNext xmlParseReset |
Syntax
try {
xmlParse(<XmlVariable>);
while (xmlParseNext()) {
amtMain(cobolPerform, <Label_1>, <Label_2>)
if (systemItems.getXmlItems().getXmlCode().equalTo(-1)) {
throw new AmtException("XML PARSE exception: XML-CODE equals -1");
} else if (systemItems.getXmlItems().getXmlCode().greaterOrEqual(1) && systemItems.getXmlItems().getXmlCode().lessOrEqual(49)) {
throw new AmtException("XML PARSE exception: XML-CODE in range 1-49");
}
}
// Not on exception code
} catch (Exception ignore) {
// On exception code
} finally {
xmlParseReset();
}
Parameters
<XmlVariable>
The XML variable to be parsed.
<Label_1>
The name of the first paragraph or section of the processing procedure.
<Label_2>
The name of the last paragraph or section of the processing procedure.
Examples
| COBOL | Java |
|---|---|
XML PARSE XML-DATA
PROCESSING PROCEDURE 0100-XML-PROCESS THRU 0100-XML-PROCESS-EXIT
ON EXCEPTION
DISPLAY 'XML ERROR: ' XML-CODE
NOT ON EXCEPTION
DISPLAY 'XML OK.'
END-XML.
|
try {
xmlParse(locDef.xml_Data);
while (xmlParseNext()) {
amtMain(cobolPerform, LABEL_0100_XML_PROCESS, LABEL_0100_XML_PROCESS_EXIT);
if (systemItems.getXmlItems().getXmlCode().equalTo(-1)) {
throw new AmtException("XML PARSE exception: XML-CODE equals -1");
} else if (systemItems.getXmlItems().getXmlCode().greaterOrEqual(1) && systemItems.getXmlItems().getXmlCode().lessOrEqual(49)) {
throw new AmtException("XML PARSE exception: XML-CODE in range 1-49");
}
}
display(noTrunc("XML OK."));
} catch (Exception ignore) {
display(concat(noTrunc("XML ERROR: "), noTrunc(systemItems.getXmlItems().getXmlCode())));
} finally {
xmlParseReset();
}
|
