Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: HDISVC00

HDISVC00.m

Go to the documentation of this file.
  1. HDISVC00 ;BPFO/JRP - PROCESS XML DOCS ON VISTA SYSTEM;1/4/2005
  1. ;;1.0;HEALTH DATA & INFORMATICS;;Feb 22, 2005
  1. ;
  1. MAIN(PRSARR,ERRARR) ;Main entry point for processing XML document
  1. ; Input : PRSARR - Array containing parsed XML document (closed root)
  1. ; This is the output of SAX^HDISVM01
  1. ; ERRARR - Array to output errors in (closed root)
  1. ;Output : None
  1. ; @ERRARR@(x) = Error text (if applicable)
  1. ; Notes : ERRARR is initialized (KILLed) on input
  1. N ROOT,TMP,OOPS,CODE,DESC
  1. ;Check input
  1. I $G(PRSARR)="" D Q
  1. .S TMP="MAIN^HDISVC00: Input parameter PRSARR was not passed"
  1. .D ADDERR(TMP,ERRARR)
  1. I '$D(@PRSARR) D Q
  1. .S TMP="MAIN^HDISVC00: Input array "_PRSARR_" (PRSARR) does not exist"
  1. .D ADDERR(TMP,ERRARR)
  1. ;Make sure data structure of parsed document exists
  1. S OOPS=0
  1. F X=1:1 S TMP=$P($T(SUBS+X),";;",2) Q:TMP="" D
  1. .I $D(@PRSARR@(TMP)) Q
  1. .S TMP="MAIN^HDISVC00: Subscript "_TMP_" missing from input array "_PRSARR_" (PRSARR)"
  1. .D ADDERR(TMP,ERRARR)
  1. .S OOPS=1
  1. I OOPS Q
  1. ;Get root element name
  1. S ROOT=$G(@PRSARR@("ESUBS",1))
  1. I ROOT="" D Q
  1. .S TMP="Root element of XML document could not be determined"
  1. .D ADDERR(TMP,ERRARR)
  1. ;Check for supported root element
  1. S OOPS=1
  1. F X=1:1 S TMP=$P($T(ROOTS+X),";;",2) Q:TMP="" D Q:'OOPS
  1. .I $P(TMP,"~",1)'=ROOT Q
  1. .S CODE=$P(TMP,"~",2)
  1. .S DESC=$P(TMP,"~",3)
  1. .S OOPS=0
  1. ;Unsupported root element
  1. I OOPS D Q
  1. .S TMP="'"_ROOT_"' is not a supported root element (don't know how to process it)"
  1. .D ADDERR(TMP,ERRARR)
  1. ;Code to process document not set
  1. I CODE="" D Q
  1. .S TMP="Code to process root element '"_ROOT_"' has not been established"
  1. .D ADDERR(TMP,ERRARR)
  1. ;Process XML document
  1. X CODE
  1. ;Done
  1. Q
  1. ;
  1. ADDERR(TXT,ERRARR) ;Add to list of errors
  1. ; Input : TXT - Error text
  1. ; ERRARR - Error array (closed root)
  1. ;Output : None
  1. ; @ERRARR@(x) = Error text
  1. ; Notes : Existance/validity of input assumed (internal call)
  1. N X
  1. I $G(ERRARR)="" Q
  1. S X=1+$O(@ERRARR@(""),-1)
  1. S @ERRARR@(X)=$G(TXT)
  1. Q
  1. ;
  1. SUBS ;Required subscripts in parse array (attributes aren't required)
  1. ;;EINDX
  1. ;;ESUBS
  1. ;;DATA
  1. ;;
  1. ;
  1. ROOTS ;Root element name~Processing code for root element~Description
  1. ;;Domain~D DOMAIN^HDISVC01(PRSARR,ERRARR)~VUID data from centralized VUID Server
  1. ;;