Changeset 1204 for ccr/trunk/p/C0CDOM.m


Ignore:
Timestamp:
Jun 23, 2011, 3:01:41 PM (13 years ago)
Author:
George Lilly
Message:

updates for MU Certification

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ccr/trunk/p/C0CDOM.m

    r1203 r1204  
    126126 Q
    127127 ;
    128 OUTXML(ZRTN,INID)       ; USES C0CMXMLB (MXMLBLD) TO OUTPUT XML FROM AN MXMLDOM
     128OUTXML(ZRTN,INID,NO1ST) ; USES C0CMXMLB (MXMLBLD) TO OUTPUT XML FROM AN MXMLDOM
    129129 ;
    130130 S C0CDOCID=INID
    131  D START^C0CMXMLB($$TAG(1),,"G")
     131 I '$D(NO1ST) S NO1ST=0 ; DO NOT SURPRESS THE <?xml tag generation
     132 D START^C0CMXMLB($$TAG(1),,"G",NO1ST)
    132133 D NDOUT($$FIRST(1))
    133134 D END^C0CMXMLB ;END THE DOCUMENT
     
    156157 S GN2=$NA(@GN@(1))
    157158 W $$OUTPUT^C0CXPATH(GN2,"nhin_"_ZDFN_".xml","/home/wvehr3-09/")
     159 Q
     160 ;
     161NARY2XML(ZGOUT,ZGIN) ; CREATE XML FROM AN NHIN ARRAY
     162 ; ZGOUT AND ZGIN ARE PASSED BY NAME
     163 N C0CDOCID
     164 W !,ZGOUT," ",ZGIN
     165 S C0CDOCID=$$DOMI(ZGIN) ; PUT IT INTO THE DOM
     166 D OUTXML(ZGOUT,C0CDOCID)
    158167 Q
    159168 ;
     
    217226 I '$D(INARY) Q 0 ; NO ARRAY PASSED
    218227 I '$D(HANDLE) S HANDLE=$$NEWDOM() ; MAKE A NEW DOM
     228 ;I PARENT="" S PARENT="root"
    219229 I +$G(PARENT)>0 S ZPARNODE=PARENT ; WE HAVE BEEN PASSED A PARENT NODE ID
    220  E  I $L(PARENT)>0 D  ; TBD FIND THE PARENT IN THE DOM AND SET LEVEL
     230 E  I $L($G(PARENT))>0 D  ; TBD FIND THE PARENT IN THE DOM AND SET LEVEL
    221231 . D STARTELE^MXMLDOM(PARENT) ; INSERT THE PARENT NODE
    222232 . S ZPARNODE=1 ;
    223233 ; WE NOW HAVE A HANDLE AND A PARENT NODE AND LEVEL HAS BEEN SET
    224  D MAJOR(INARY,"",0) ; PROCESS ALL THE NODES TO BE ADDED
    225  I $L(PARENT)>0 D ENDELE^MXMLDOM(PARENT) ; CLOSE OUT THE PARENT NODE
    226  Q 1 ; SUCCESS
     234 N ZEXARY
     235 D EXPAND("ZEXARY",INARY) ; EXPAND THE NHIN ARRAY
     236 D MAJOR("ZEXARY") ; PROCESS ALL THE NODES TO BE ADDED
     237 I $L($G(PARENT))>0 D ENDELE^MXMLDOM(PARENT) ; CLOSE OUT THE PARENT NODE
     238 Q HANDLE ; SUCCESS
    227239 ;
    228 MAJOR(ZARY,ZTAG,ZNUM) ; RECURSIVE ROUTINE FOR INTERMEDIATE NODES
     240MAJOR(ZARY) ; RECURSIVE ROUTINE FOR INTERMEDIATE NODES
    229241 N ZI S ZI=""
     242 N ZTAG
    230243 F  S ZI=$O(@ZARY@(ZI)) Q:ZI=""  D  ; FOR EACH SECTION
     244 . N ZELEADD S ZELEADD=0
     245 . I ZI["@" D  ; END NODE HAS NO VALUE, ONLY ATTRIBUTES
     246 . . S ZTAG=$P(ZI,"@",1) ; PULL OUT THE TAG
     247 . . K ZATT ; CLEAR OUT LAST ONE
     248 . . M ZATT=@ZARY@(ZI,1) ; GET ATTRIBUTE ARRAY
     249 . . D STARTELE^MXMLDOM(ZTAG,.ZATT) ; ADD THE NODE
     250 . . S ZELEADD=1 ; FLAG TO NOT ADD THE ELEMENT TWICE
     251 . I $O(@ZARY@(ZI,""))="" D  ;END NODE
     252 . . S ZTAG=ZI ; USE ZI FOR THE TAG
     253 . . I 'ZELEADD D STARTELE^MXMLDOM(ZTAG) ; ADD ELEMENT IF NOT THERE
     254 . . S ZELEADD=1 ; ADDED AN ELEMENT
     255 . . D CHAR^MXMLDOM($G(@ZARY@(ZI))) ; INSERT THE VALUE
     256 . I ZELEADD D  Q  ; NO MORE TO DO ON THIS LEVEL
     257 . . D ENDELE^MXMLDOM(ZTAG) ; CLOSE THE ELEMENT BEFORE LEAVING
     258 . N NEWARY ; INDENTED ARRAY
    231259 . N ZN S ZN=0
    232260 . F  S ZN=$O(@ZARY@(ZI,ZN)) Q:ZN=""  D  ; FOR EACH MULTIPLE
    233  . . N ZS S ZS=""
    234  . . I $O(@ZARY@(ZI,ZN,ZS))'["." D  ; END NODES HERE
    235  . . . N NEWARY
    236  . . . S NEWARY=$NA(@ZARY@(ZI,ZN))
    237  . . . D MINOR("NEWARY") ; INSERT THE END NODES
    238  . . E  F  S ZS=$O(@ZARY@(ZI,ZN,ZS)) Q:ZS=""  D  ; FOR EACH STRING
    239  . . . I ZS["." D  ; INTERMEDIATE NODE FOUND
    240  . . . . W !,"IM:",ZS
    241  . . . W !,ZI,":",ZN,":",ZS_" : ",@ZARY@(ZI,ZN,ZS)
    242  Q
    243  ;
    244 MINOR(ZINARY) ; DOES THE WORK FOR END NODES, HANDLES ATTRIBUTES
    245  ;
    246  N ZZI S ZZI=""
    247  F  S ZZI=$O(@ZINARY@(ZZI)) Q:ZZI=""  D  ;
    248  . W !,"MINOR",ZZI,":",@ZINARY@(ZZI)
     261 . . D STARTELE^MXMLDOM(ZI) ; ADD THE INTERMEDIATE TAG
     262 . . S NEWARY=$NA(@ZARY@(ZI,ZN)) ; INDENT THE ARRAY
     263 . . D MAJOR(NEWARY) ; RECURSE FOR INDENTED ARRAY
     264 . . D ENDELE^MXMLDOM(ZI) ; END THE INTERMEDIATE TAG
    249265 Q
    250266 ;
     
    268284 . . . N ZZV ; PLACE TO STASH THE VALUE
    269285 . . . S ZZV=@ZZIN@(ZZI,ZZN,ZZS) ; VALUE
     286 . . . W !,"VALUE:",ZZV
    270287 . . . N GK ; COUNTER
    271288 . . . F GK=1:1:$L(ZZS,".") D  ; FOR EACH INTERMEDIATE NODE
     
    292309 Q
    293310 ;
    294 POP(OSTR,ISTR) ; EXTRINSIC WHICH RETURNS TRUE IF ISTR IS EMPTY
    295  ; IF ISTR IS NOT EMPTY, LOOKS FOR "." AND "@" AND RETURNS
    296  ; xxx,1,yyyetc for xxx.yyyetc   and xx@,1,yyy for xxx@yyyetc
    297  ; OSTR IS PASSED BY REFERENCE AND CONTAINS yyyetc
    298  I $L(ISTR)=0 Q 1 ; WE ARE DONE
    299  N ZG,ZN,ZR
    300  S ZN=1
    301  I ISTR["." D  ;
    302  . S ZG=$P(ISTR,".",1)
    303  . S OSTR=$P(ISTR,".",2)
    304  . S ZR=ZG_","_ZN_","_OSTR
    305  Q ZR
    306  ;
    307311NEWDOM() ; extrinsic which creates a new DOM and returns the HANDLE
    308312 N CBK,SUCCESS,LEVEL,NODE,HANDLE
     
    314318 Q HANDLE
    315319 ;
    316  
    317 
Note: See TracChangeset for help on using the changeset viewer.