source: FOIAVistA/tag/r/ONCOLOGY-ONC/ONCSAPIX.m@ 1569

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

initial load of FOIAVistA 6/30/08 version

File size: 3.1 KB
Line 
1ONCSAPIX ;Hines OIFO/SG - COLLABORATIVE STAGING (XML TOOLS) ; 8/11/06 8:11am
2 ;;2.11;ONCOLOGY;**40,47**;Mar 07, 1995;Build 19
3 ;
4 ; ONCXML -------------- DESCRIPTOR FOR THE XML PARSING
5 ;
6 ; ONCXML( Closed root of the destination buffer
7 ;
8 ; "ERR") Number of parsing errors
9 ;
10 ; "FAULTCODE") SOAP error code
11 ; "FAULTSTRING") SOAP error description
12 ;
13 ; "PATH") Path to the current XML tag
14 ;
15 ; "RC") Error code returned by the web-service
16 ;
17 ; "TI") Number of the current text line of
18 ; the current tag value
19 ;
20 ; "TEXT") Buffer for the current tag text
21 ;
22 Q
23 ;
24 ;***** DUMMY CALLBACKS FOR THE SAX PARSER
25DUMMY(DUMMY1,DUMMY2,DUMMY3) ;
26DUMMY1 Q
27 ;
28 ;***** END ELEMENT CALLBACK FOR THE SAX PARSER
29 ;
30 ; ELMT Name of the element
31 ;
32ENDEL(ELMT) ;
33 S ONCXML("PATH")=$P(ONCXML("PATH"),",",1,$L(ONCXML("PATH"),",")-1)
34 Q
35 ;
36 ;***** ERROR CALLBACK FOR THE SAX PARSER
37 ;
38 ; .ERR Reference to a local variable containing
39 ; informations about the error
40 ;
41ERROR(ERR) ;
42 N ERRCODE,ONCINFO,TMP
43 I ERR("SEV") D
44 . S ERRCODE=-4,ONCXML("ERR")=$G(ONCXML("ERR"))+1
45 E S ERRCODE=-3
46 ;--- Prepare message details
47 S TMP=$P("Warning^Validation Error^Conformance Error",U,ERR("SEV")+1)
48 S ONCINFO(1)=TMP_" in line #"_ERR("LIN")_" (position #"_ERR("POS")_")"
49 S ONCINFO(2)=$TR(ERR("XML"),$C(9,10,13)," ")
50 ;--- Record the error message
51 D STORE^ONCSAPIE(ERRCODE_U_$TR(ERR("MSG"),U,"~"),"ONCINFO")
52 Q
53 ;
54 ;***** SETS THE EVENT INTERFACE ENTRY POINTS
55 ;
56 ; .CBK Reference to the destination list
57 ;
58SETCBK(CBK,CBKTBL) ;
59 ;;CHARACTERS ^ TEXT^ONCSAPIX
60 ;;COMMENT ^ DUMMY^ONCSAPIX
61 ;;DOCTYPE ^ DUMMY^ONCSAPIX
62 ;;ENDDOCUMENT ^ DUMMY1^ONCSAPIX
63 ;;ENDELEMENT ^ ENDEL^ONCSAPIX
64 ;;ERROR ^ ERROR^ONCSAPIX
65 ;;EXTERNAL ^ DUMMY^ONCSAPIX
66 ;;NOTATION ^ DUMMY^ONCSAPIX
67 ;;PI ^ DUMMY^ONCSAPIX
68 ;;STARTDOCUMENT^STARTDOC^ONCSAPIX
69 ;;STARTELEMENT ^ STARTEL^ONCSAPIX
70 ;
71 N I,NAME,TMP,XGET K CBK
72 D:$G(CBKTBL)'=""
73 . S XGET(2)="S TMP=$T("_$P(CBKTBL,"^")_"+I^"_$P(CBKTBL,"^",2)_")"
74 S XGET(1)="S TMP=$T(SETCBK+I)"
75 ;---
76 S XGET=""
77 F S XGET=$O(XGET(XGET)) Q:XGET="" D
78 . F I=1:1 X XGET(XGET) S TMP=$TR($P(TMP,";;",2)," ") Q:TMP="" D
79 . . S NAME=$P(TMP,U),CBK(NAME)=$P(TMP,U,2,3)
80 Q
81 ;
82 ;***** START DOCUMENT CALLBACK FOR THE SAX PARSER
83STARTDOC ;
84 S ONCXML("PATH")="",ONCXML("ERR")=0
85 Q
86 ;
87 ;***** START ELEMENT CALLBACK FOR THE SAX PARSER
88 ;
89 ; ELMT Name of the element
90 ;
91 ; .ATTR List of attributes and their values
92 ;
93STARTEL(ELMT,ATTR) ;
94 S ONCXML("PATH")=ONCXML("PATH")_$S(ONCXML("PATH")'="":",",1:"")_ELMT
95 S ONCXML("TI")=1 K ONCXML("TEXT")
96 Q
97 ;
98 ;***** TEXT CALLBACK FOR THE SAX PARSER
99 ;
100 ; TXT Line of unmarked text
101 ;
102TEXT(TXT) ;
103 I ONCXML("PATH")?1.E1"Fault,faultcode" D Q
104 . S ONCXML("FAULTCODE")=$G(ONCXML("FAULTCODE"))_TXT
105 I ONCXML("PATH")?1.E1"Fault,faultstring" D Q
106 . S ONCXML("FAULTSTRING")=$G(ONCXML("FAULTSTRING"))_TXT
107 I ONCXML("PATH")?1.E1"Fault,detail,RC" D Q
108 . S ONCXML("RC")=$G(ONCXML("RC"))_TXT
109 Q
Note: See TracBrowser for help on using the repository browser.