source: FOIAVistA/tag/r/HEALTH_DATA_AND_INFORMATICS-HDI/HDISVC00.m@ 628

Last change on this file since 628 was 628, checked in by George Lilly, 14 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.2 KB
Line 
1HDISVC00 ;BPFO/JRP - PROCESS XML DOCS ON VISTA SYSTEM;1/4/2005
2 ;;1.0;HEALTH DATA & INFORMATICS;;Feb 22, 2005
3 ;
4MAIN(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^HDISVC00: Input parameter PRSARR was not passed"
15 .D ADDERR(TMP,ERRARR)
16 I '$D(@PRSARR) D Q
17 .S TMP="MAIN^HDISVC00: Input array "_PRSARR_" (PRSARR) does not exist"
18 .D ADDERR(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^HDISVC00: Subscript "_TMP_" missing from input array "_PRSARR_" (PRSARR)"
24 .D ADDERR(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(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(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(TMP,ERRARR)
47 ;Process XML document
48 X CODE
49 ;Done
50 Q
51 ;
52ADDERR(TXT,ERRARR) ;Add to list of errors
53 ; Input : TXT - Error text
54 ; ERRARR - Error array (closed root)
55 ;Output : None
56 ; @ERRARR@(x) = Error text
57 ; Notes : Existance/validity of input assumed (internal call)
58 N X
59 I $G(ERRARR)="" Q
60 S X=1+$O(@ERRARR@(""),-1)
61 S @ERRARR@(X)=$G(TXT)
62 Q
63 ;
64SUBS ;Required subscripts in parse array (attributes aren't required)
65 ;;EINDX
66 ;;ESUBS
67 ;;DATA
68 ;;
69 ;
70ROOTS ;Root element name~Processing code for root element~Description
71 ;;Domain~D DOMAIN^HDISVC01(PRSARR,ERRARR)~VUID data from centralized VUID Server
72 ;;
Note: See TracBrowser for help on using the repository browser.