ONCSAPIX ;Hines OIFO/SG - COLLABORATIVE STAGING (XML TOOLS) ; 8/11/06 8:11am
;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
;
; ONCXML -------------- DESCRIPTOR FOR THE XML PARSING
;
; ONCXML( Closed root of the destination buffer
;
; "ERR") Number of parsing errors
;
; "FAULTCODE") SOAP error code
; "FAULTSTRING") SOAP error description
;
; "PATH") Path to the current XML tag
;
; "RC") Error code returned by the web-service
;
; "TI") Number of the current text line of
; the current tag value
;
; "TEXT") Buffer for the current tag text
;
Q
;
;***** DUMMY CALLBACKS FOR THE SAX PARSER
DUMMY(DUMMY1,DUMMY2,DUMMY3) ;
DUMMY1 Q
;
;***** END ELEMENT CALLBACK FOR THE SAX PARSER
;
; ELMT Name of the element
;
ENDEL(ELMT) ;
S ONCXML("PATH")=$P(ONCXML("PATH"),",",1,$L(ONCXML("PATH"),",")-1)
Q
;
;***** ERROR CALLBACK FOR THE SAX PARSER
;
; .ERR Reference to a local variable containing
; informations about the error
;
ERROR(ERR) ;
N ERRCODE,ONCINFO,TMP
I ERR("SEV") D
. S ERRCODE=-4,ONCXML("ERR")=$G(ONCXML("ERR"))+1
E S ERRCODE=-3
;--- Prepare message details
S TMP=$P("Warning^Validation Error^Conformance Error",U,ERR("SEV")+1)
S ONCINFO(1)=TMP_" in line #"_ERR("LIN")_" (position #"_ERR("POS")_")"
S ONCINFO(2)=$TR(ERR("XML"),$C(9,10,13)," ")
;--- Record the error message
D STORE^ONCSAPIE(ERRCODE_U_$TR(ERR("MSG"),U,"~"),"ONCINFO")
Q
;
;***** SETS THE EVENT INTERFACE ENTRY POINTS
;
; .CBK Reference to the destination list
;
SETCBK(CBK,CBKTBL) ;
;;CHARACTERS ^ TEXT^ONCSAPIX
;;COMMENT ^ DUMMY^ONCSAPIX
;;DOCTYPE ^ DUMMY^ONCSAPIX
;;ENDDOCUMENT ^ DUMMY1^ONCSAPIX
;;ENDELEMENT ^ ENDEL^ONCSAPIX
;;ERROR ^ ERROR^ONCSAPIX
;;EXTERNAL ^ DUMMY^ONCSAPIX
;;NOTATION ^ DUMMY^ONCSAPIX
;;PI ^ DUMMY^ONCSAPIX
;;STARTDOCUMENT^STARTDOC^ONCSAPIX
;;STARTELEMENT ^ STARTEL^ONCSAPIX
;
N I,NAME,TMP,XGET K CBK
D:$G(CBKTBL)'=""
. S XGET(2)="S TMP=$T("_$P(CBKTBL,"^")_"+I^"_$P(CBKTBL,"^",2)_")"
S XGET(1)="S TMP=$T(SETCBK+I)"
;---
S XGET=""
F S XGET=$O(XGET(XGET)) Q:XGET="" D
. F I=1:1 X XGET(XGET) S TMP=$TR($P(TMP,";;",2)," ") Q:TMP="" D
. . S NAME=$P(TMP,U),CBK(NAME)=$P(TMP,U,2,3)
Q
;
;***** START DOCUMENT CALLBACK FOR THE SAX PARSER
STARTDOC ;
S ONCXML("PATH")="",ONCXML("ERR")=0
Q
;
;***** START ELEMENT CALLBACK FOR THE SAX PARSER
;
; ELMT Name of the element
;
; .ATTR List of attributes and their values
;
STARTEL(ELMT,ATTR) ;
S ONCXML("PATH")=ONCXML("PATH")_$S(ONCXML("PATH")'="":",",1:"")_ELMT
S ONCXML("TI")=1 K ONCXML("TEXT")
Q
;
;***** TEXT CALLBACK FOR THE SAX PARSER
;
; TXT Line of unmarked text
;
TEXT(TXT) ;
I ONCXML("PATH")?1.E1"Fault,faultcode" D Q
. S ONCXML("FAULTCODE")=$G(ONCXML("FAULTCODE"))_TXT
I ONCXML("PATH")?1.E1"Fault,faultstring" D Q
. S ONCXML("FAULTSTRING")=$G(ONCXML("FAULTSTRING"))_TXT
I ONCXML("PATH")?1.E1"Fault,detail,RC" D Q
. S ONCXML("RC")=$G(ONCXML("RC"))_TXT
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCSAPIX 3265 printed Nov 22, 2024@17:37:54 Page 2
ONCSAPIX ;Hines OIFO/SG - COLLABORATIVE STAGING (XML TOOLS) ; 8/11/06 8:11am
+1 ;;2.2;ONCOLOGY;**1**;Jul 31, 2013;Build 8
+2 ;
+3 ; ONCXML -------------- DESCRIPTOR FOR THE XML PARSING
+4 ;
+5 ; ONCXML( Closed root of the destination buffer
+6 ;
+7 ; "ERR") Number of parsing errors
+8 ;
+9 ; "FAULTCODE") SOAP error code
+10 ; "FAULTSTRING") SOAP error description
+11 ;
+12 ; "PATH") Path to the current XML tag
+13 ;
+14 ; "RC") Error code returned by the web-service
+15 ;
+16 ; "TI") Number of the current text line of
+17 ; the current tag value
+18 ;
+19 ; "TEXT") Buffer for the current tag text
+20 ;
+21 QUIT
+22 ;
+23 ;***** DUMMY CALLBACKS FOR THE SAX PARSER
DUMMY(DUMMY1,DUMMY2,DUMMY3) ;
DUMMY1 QUIT
+1 ;
+2 ;***** END ELEMENT CALLBACK FOR THE SAX PARSER
+3 ;
+4 ; ELMT Name of the element
+5 ;
ENDEL(ELMT) ;
+1 SET ONCXML("PATH")=$PIECE(ONCXML("PATH"),",",1,$LENGTH(ONCXML("PATH"),",")-1)
+2 QUIT
+3 ;
+4 ;***** ERROR CALLBACK FOR THE SAX PARSER
+5 ;
+6 ; .ERR Reference to a local variable containing
+7 ; informations about the error
+8 ;
ERROR(ERR) ;
+1 NEW ERRCODE,ONCINFO,TMP
+2 IF ERR("SEV")
Begin DoDot:1
+3 SET ERRCODE=-4
SET ONCXML("ERR")=$GET(ONCXML("ERR"))+1
End DoDot:1
+4 IF '$TEST
SET ERRCODE=-3
+5 ;--- Prepare message details
+6 SET TMP=$PIECE("Warning^Validation Error^Conformance Error",U,ERR("SEV")+1)
+7 SET ONCINFO(1)=TMP_" in line #"_ERR("LIN")_" (position #"_ERR("POS")_")"
+8 SET ONCINFO(2)=$TRANSLATE(ERR("XML"),$CHAR(9,10,13)," ")
+9 ;--- Record the error message
+10 DO STORE^ONCSAPIE(ERRCODE_U_$TRANSLATE(ERR("MSG"),U,"~"),"ONCINFO")
+11 QUIT
+12 ;
+13 ;***** SETS THE EVENT INTERFACE ENTRY POINTS
+14 ;
+15 ; .CBK Reference to the destination list
+16 ;
SETCBK(CBK,CBKTBL) ;
+1 ;;CHARACTERS ^ TEXT^ONCSAPIX
+2 ;;COMMENT ^ DUMMY^ONCSAPIX
+3 ;;DOCTYPE ^ DUMMY^ONCSAPIX
+4 ;;ENDDOCUMENT ^ DUMMY1^ONCSAPIX
+5 ;;ENDELEMENT ^ ENDEL^ONCSAPIX
+6 ;;ERROR ^ ERROR^ONCSAPIX
+7 ;;EXTERNAL ^ DUMMY^ONCSAPIX
+8 ;;NOTATION ^ DUMMY^ONCSAPIX
+9 ;;PI ^ DUMMY^ONCSAPIX
+10 ;;STARTDOCUMENT^STARTDOC^ONCSAPIX
+11 ;;STARTELEMENT ^ STARTEL^ONCSAPIX
+12 ;
+13 NEW I,NAME,TMP,XGET
KILL CBK
+14 if $GET(CBKTBL)'=""
Begin DoDot:1
+15 SET XGET(2)="S TMP=$T("_$PIECE(CBKTBL,"^")_"+I^"_$PIECE(CBKTBL,"^",2)_")"
End DoDot:1
+16 SET XGET(1)="S TMP=$T(SETCBK+I)"
+17 ;---
+18 SET XGET=""
+19 FOR
SET XGET=$ORDER(XGET(XGET))
if XGET=""
QUIT
Begin DoDot:1
+20 FOR I=1:1
XECUTE XGET(XGET)
SET TMP=$TRANSLATE($PIECE(TMP,";;",2)," ")
if TMP=""
QUIT
Begin DoDot:2
+21 SET NAME=$PIECE(TMP,U)
SET CBK(NAME)=$PIECE(TMP,U,2,3)
End DoDot:2
End DoDot:1
+22 QUIT
+23 ;
+24 ;***** START DOCUMENT CALLBACK FOR THE SAX PARSER
STARTDOC ;
+1 SET ONCXML("PATH")=""
SET ONCXML("ERR")=0
+2 QUIT
+3 ;
+4 ;***** START ELEMENT CALLBACK FOR THE SAX PARSER
+5 ;
+6 ; ELMT Name of the element
+7 ;
+8 ; .ATTR List of attributes and their values
+9 ;
STARTEL(ELMT,ATTR) ;
+1 SET ONCXML("PATH")=ONCXML("PATH")_$SELECT(ONCXML("PATH")'="":",",1:"")_ELMT
+2 SET ONCXML("TI")=1
KILL ONCXML("TEXT")
+3 QUIT
+4 ;
+5 ;***** TEXT CALLBACK FOR THE SAX PARSER
+6 ;
+7 ; TXT Line of unmarked text
+8 ;
TEXT(TXT) ;
+1 IF ONCXML("PATH")?1.E1"Fault,faultcode"
Begin DoDot:1
+2 SET ONCXML("FAULTCODE")=$GET(ONCXML("FAULTCODE"))_TXT
End DoDot:1
QUIT
+3 IF ONCXML("PATH")?1.E1"Fault,faultstring"
Begin DoDot:1
+4 SET ONCXML("FAULTSTRING")=$GET(ONCXML("FAULTSTRING"))_TXT
End DoDot:1
QUIT
+5 IF ONCXML("PATH")?1.E1"Fault,detail,RC"
Begin DoDot:1
+6 SET ONCXML("RC")=$GET(ONCXML("RC"))_TXT
End DoDot:1
QUIT
+7 QUIT