Changeset 606


Ignore:
Timestamp:
Nov 18, 2009, 4:46:04 PM (15 years ago)
Author:
George Lilly
Message:

support for XML output from the MXML DOM

File:
1 edited

Legend:

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

    r605 r606  
    2929        Q
    3030        ;
     31TEST4 ; TEST OF OUTPUTING AN XML FILE FROM THE DOM .. this one is the CCR
     32 ;
     33 D TEST ; SET UP THE DOM
     34 D START^C0CMXMLB($$TAG(1),,"G")
     35 D NDOUT($$FIRST(1))
     36 D END^C0CMXMLB ;END THE DOCUMENT
     37 M ZCCR=^TMP("MXMLBLD",$J)
     38 ZWR ZCCR
     39 Q
     40 ;
     41TEST5 ; SAME AS TEST4, BUT THIS TIME THE CCD
     42 S C0CXMLIN=$NA(^TMP("C0CMXML",$J))
     43 K GARY,GTMP,GIDX
     44 K @C0CXMLIN
     45 W $$FTG^%ZISH("/home/vademo2/CCR/","SampleCCDDocument.xml",$NA(@C0CXMLIN@(1)),3)
     46 D CLEANARY("GTMP",C0CXMLIN) ; REMOVE CONTROL CHARACTERS
     47 K @C0CXMLIN
     48 M @C0CXMLIN=GTMP
     49 K GTMP
     50 D STRIPTXT("GTMP",C0CXMLIN)
     51 K @C0CXMLIN
     52 M @C0CXMLIN=GTMP
     53 K GTMP
     54 S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DOCID: ",C0CDOCID  ;CALL REGULAR PARSER
     55 ;D XPATH(1,"/","GIDX2","GARY2",,REDUX)
     56 D OUTXML("ZCCD",C0CDOCID)
     57 ;D START^C0CMXMLB($$TAG(1),,"G")
     58 ;D NDOUT($$FIRST(1))
     59 ;D END^C0CMXMLB ;END THE DOCUMENT
     60 ;M ZCCD=^TMP("MXMLBLD",$J)
     61 ZWR ZCCD(1:30)
     62 Q
     63 ;
    3164TEST2   ;
    3265        S REDUX="//soap:Envelope/soap:Body/GetPatientFullMedicationHistory5Response/GetPatientFullMedicationHistory5Result/patientDrugDetail"
     
    5386 D SETCBK ; SET THE CALLBACK ROUTINE FOR TAGS
    5487 D XPATH(1,"/","GIDX","GARY",,REDUX)
     88 K C0CCBK("TAG")
    5589 D SEPARATE("GARY2","GARY") ; SEPARATE FOR EASIER BROWSING
    5690 ;S C0CDOCID=$$PARSE(C0CXMLIN) W !,"DOCID: ",C0CDOCID  ;CALL REGULAR PARSER
     
    111145 Q $$PARENT^MXMLDOM(C0CDOCID,ZOID)
    112146 ;
     147ATT(RTN,NODE) ;GET ATTRIBUTES FOR ZOID
     148 S HANDLE=C0CDOCID
     149 K @RTN
     150 D GETTXT^MXMLDOM("A")
     151 Q
     152 ;
    113153TAG(ZOID)       ; RETURNS THE XML TAG FOR THE NODE
    114154        ;I ZOID=149 B ;GPLTEST
     
    130170        Q
    131171        ;
     172OUTXML(ZRTN,INID) ; USES C0CMXMLB (MXMLBLD) TO OUTPUT XML FROM AN MXMLDOM
     173 ;
     174 S C0CDOCID=INID
     175 D START^C0CMXMLB($$TAG(1),,"G")
     176 D NDOUT($$FIRST(1))
     177 D END^C0CMXMLB ;END THE DOCUMENT
     178 M @ZRTN=^TMP("MXMLBLD",$J)
     179 K ^TMP("MXMLBLD",$J),^TMP("MXMLDOM",$J)
     180 Q
     181 ;
     182NDOUT(ZOID) ;CALLBACK ROUTINE - IT IS RECURSIVE
     183 I $$FIRST(ZOID)'=0 D  ; THERE IS A CHILD
     184 . N ZI S ZI=$$FIRST(ZOID)
     185 . N ZATT D ATT("ZATT",ZOID)
     186 . D MULTI^C0CMXMLB("",$$TAG(ZOID),.ZATT,"NDOUT^C0CMXML(ZI)")
     187 E  D  ; NO CHILD
     188 . ;W "DOING",ZOID,!
     189 . N ZD D DATA("ZD",ZOID)
     190 . N ZATT D ATT("ZATT",ZOID)
     191 . D ITEM^C0CMXMLB("",$$TAG(ZOID),.ZATT,$G(ZD(1)))
     192 I $$NXTSIB(ZOID)'=0 D  ; THERE IS A SIBLING
     193 . D NDOUT($$NXTSIB(ZOID)) ;RECURSE FOR SIBLINGS
     194 Q
     195 ;
    132196PARSCCD(DOC,OPTION) ; THIS WAS COPIED FROM EN^MXMLDOM TO CUSTIMIZE FOR
    133197 ; PROCESSING CCDS
Note: See TracChangeset for help on using the changeset viewer.