| 1 | HDISVS00 ;BPFO/JRP - PROCESS XML DOCS ON CENTRAL SERVER;1/4/2005 | 
|---|
| 2 | ;;1.0;HEALTH DATA & INFORMATICS;;Feb 22, 2005 | 
|---|
| 3 | ; | 
|---|
| 4 | MAIN(PRSARR,ERRARR) ;Main entry point for processing XML document | 
|---|
| 5 | ; Input : PRSARR - Array containing parsed XML document (closed root) | 
|---|
| 6 | ;                  This is the output of SAX^HDISVM01 | 
|---|
| 7 | ;         ERRARR - Array to output errors in (closed root) | 
|---|
| 8 | ;Output : None | 
|---|
| 9 | ;         @ERRARR@(x) = Error text (if applicable) | 
|---|
| 10 | ; Notes : ERRARR is initialized (KILLed) on input | 
|---|
| 11 | N ROOT,TMP,OOPS,CODE,DESC | 
|---|
| 12 | ;Check input | 
|---|
| 13 | I $G(PRSARR)="" D  Q | 
|---|
| 14 | .S TMP="MAIN^HDISVS00: Input parameter PRSARR was not passed" | 
|---|
| 15 | .D ADDERR^HDISVC00(TMP,ERRARR) | 
|---|
| 16 | I '$D(@PRSARR) D  Q | 
|---|
| 17 | .S TMP="MAIN^HDISVS00: Input array "_PRSARR_" (PRSARR) does not exist" | 
|---|
| 18 | .D ADDERR^HDISVC00(TMP,ERRARR) | 
|---|
| 19 | ;Make sure data structure of parsed document exists | 
|---|
| 20 | S OOPS=0 | 
|---|
| 21 | F X=1:1 S TMP=$P($T(SUBS+X),";;",2) Q:TMP=""  D | 
|---|
| 22 | .I $D(@PRSARR@(TMP)) Q | 
|---|
| 23 | .S TMP="MAIN^HDISVS00: Subscript "_TMP_" missing from input array "_PRSARR_" (PRSARR)" | 
|---|
| 24 | .D ADDERR^HDISVC00(TMP,ERRARR) | 
|---|
| 25 | .S OOPS=1 | 
|---|
| 26 | I OOPS Q | 
|---|
| 27 | ;Get root element name | 
|---|
| 28 | S ROOT=$G(@PRSARR@("ESUBS",1)) | 
|---|
| 29 | I ROOT="" D  Q | 
|---|
| 30 | .S TMP="Root element of XML document could not be determined" | 
|---|
| 31 | .D ADDERR^HDISVC00(TMP,ERRARR) | 
|---|
| 32 | ;Check for supported root element | 
|---|
| 33 | S OOPS=1 | 
|---|
| 34 | F X=1:1 S TMP=$P($T(ROOTS+X),";;",2) Q:TMP=""  D  Q:'OOPS | 
|---|
| 35 | .I $P(TMP,"~",1)'=ROOT Q | 
|---|
| 36 | .S CODE=$P(TMP,"~",2) | 
|---|
| 37 | .S DESC=$P(TMP,"~",3) | 
|---|
| 38 | .S OOPS=0 | 
|---|
| 39 | ;Unsupported root element | 
|---|
| 40 | I OOPS D  Q | 
|---|
| 41 | .S TMP="'"_ROOT_"' is not a supported root element (don't know how to process it)" | 
|---|
| 42 | .D ADDERR^HDISVC00(TMP,ERRARR) | 
|---|
| 43 | ;Code to process document not set | 
|---|
| 44 | I CODE="" D  Q | 
|---|
| 45 | .S TMP="Code to process root element '"_ROOT_"' has not been established" | 
|---|
| 46 | .D ADDERR^HDISVC00(TMP,ERRARR) | 
|---|
| 47 | ;Process XML document | 
|---|
| 48 | X CODE | 
|---|
| 49 | ;Done | 
|---|
| 50 | Q | 
|---|
| 51 | ; | 
|---|
| 52 | SUBS ;Required subscripts in parse array (attributes aren't required) | 
|---|
| 53 | ;;EINDX | 
|---|
| 54 | ;;ESUBS | 
|---|
| 55 | ;;DATA | 
|---|
| 56 | ;; | 
|---|
| 57 | ; | 
|---|
| 58 | ROOTS ;Root element name~Processing code for root element~Description | 
|---|
| 59 | ;;Domain~D VUID^HDISVS01(PRSARR,ERRARR)~Request for VUID data from VistA system | 
|---|
| 60 | ;;HDISParameters~D STATUS^HDISVS03(PRSARR,ERRARR)~Status update from VistA system | 
|---|
| 61 | ;; | 
|---|