Changeset 728


Ignore:
Timestamp:
Mar 27, 2010, 1:31:47 AM (15 years ago)
Author:
George Lilly
Message:

updates to XML processing

Location:
ccr/trunk/p
Files:
3 edited

Legend:

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

    r727 r728  
    102102 I $$GET1^DIQ(C0CXPF,TEMPID_",",C0CXTFLD,,OUTXML)'=OUTXML D  Q  ;
    103103 . W "ERROR RETRIEVING TEMPLATE",!
     104 Q
     105 ;
     106COPYWP(ZFLD,ZSRCREC,ZDESTREC,ZSRCF,ZDESTF) ; COPIES A WORD PROCESSING FIELD
     107 ; FROM ONE RECORD TO ANOTHER RECORD
     108 ; ZFLD IS EITHER A NUMBERIC FIELD OR A NAME IN ZSRCF
     109 ; ZSRCF IS THE SOURCE FILE, IN FILE REDIRECT FORMAT
     110 ; IF ZSRCF IS OMMITED, THE DEFAULT C0C XML MISC FILE WILL BE ASSUMED
     111 ; ZDESTF IS DESTINATION FILE. IF OMMITED, IS ASSUMED TO BE THE SAME
     112 ; A ZSRCF
     113 I '$D(ZSRCF) D  ;
     114 . S ZSRCF="ZSRCF"
     115 . D INITFARY^C0CSOAP(ZSRCF)
     116 I '$D(ZDESTF) D  ;
     117 . S ZDESTF="ZDESTF"
     118 . M @ZDESTF=@ZSRCF
     119 N ZSF,ZDF,ZSFREF,ZDFREF
     120 S ZSF=@ZSRCF@("XML FILE NUMBER")
     121 S ZSFREF=$$FILEREF^C0CRNF(ZSF)
     122 S ZDF=@ZDESTF@("XML FILE NUMBER")
     123 S ZDFREF=$$FILEREF^C0CRNF(ZDF)
     124 N ZSIEN,ZDIEN
     125 S ZSIEN=$O(@ZSFREF@("B",ZSRCREC,""))
     126 I ZSIEN="" W !,"ERROR SOURCE RECORD NOT FOUND" Q  ;
     127 S ZDIEN=$O(@ZDFREF@("B",ZDESTREC,""))
     128 I ZDIEN="" W !,"ERROR DESTINATION RECORD NOT FOUND" Q  ;
     129 N ZFLDNUM
     130 I +ZFLD=0 S ZFLDNUM=@ZSRCF@(ZFLD) ; IF FIELD IS PASSED BY NAME
     131 E  S ZFLDNUM=ZFLD ; IF FIELD IS PASSED BY NUMBER
     132 N ZWP,ZWPN
     133 S ZWPN=$$GET1^DIQ(ZSF,ZSIEN_",",ZFLDNUM,,"ZWP") ; GET WP FROM SOURCE
     134 I ZWPN'="ZWP" W !,"ERROR SOURCE FIELD EMPTY" Q  ;
     135 D WP^DIE(ZDF,ZDIEN_",",ZFLDNUM,,"ZWP") ; PUT WP FIELD TO DEST
    104136 Q
    105137 ;
  • ccr/trunk/p/C0CSOAP.m

    r718 r728  
    6868 Q
    6969 ;
    70 SOAP(C0CRTN,C0CTID,C0CVA,C0CVOR,ALTXML) ; MAKES A SOAP CALL FOR
     70SOAP(C0CRTN,C0CTID,C0CVA,C0CVOR,ALTXML,IFARY) ; MAKES A SOAP CALL FOR
    7171 ; TEMPLATE ID C0CTID
    7272 ; RETURNS THE XML RESULT IN C0CRTN, PASSED BY NAME
     
    110110 ; END ARTIFACTS
    111111 ;
    112  D INITFARY("C0CF") ; SET FILE NUMBER AND PARAMATERS
     112 I '$D(IFARY) D INITFARY("C0CF") ; SET FILE NUMBER AND PARAMATERS
     113 E  D  ;
     114 . K C0CF
     115 . M C0CF=@IFARY
    113116 S C0CXF=C0CF("XML FILE NUMBER") ; FILE NUMBER FOR THE XML TEMPLATE FILE
    114117 I +C0CTID=0 D  ; A STRING WAS PASSED FOR THE TEMPLATE NAME
     
    139142 I $G(C0CPROXY) S C0CURL=C0CPURL
    140143 K C0CRSLT,C0CRHDR
     144 B
    141145 S ok=$$httpPOST^%zewdGTM(C0CURL,.XML,C0CMIME,.C0CRSLT,.HEADER,"",.gpl5,.C0CRHDR)
    142146 K C0CRXML
    143147 D NORMAL("C0CRXML","C0CRSLT(1)") ;RETURN XML IN AN ARRAY
    144  N C0CFR S C0CFR=C0CF("REPLY TEMPLATE")
     148 N C0CFR S C0CFR=$G(C0CF("REPLY TEMPLATE"))
    145149 S C0CR=$$GET1^DIQ(C0CXF,C0CUTID_",",C0CFR,"I") ; REPLY TEMPLATE
    146150 ; reply templates are optional and are specified by populating a
  • ccr/trunk/p/C0CXPATH.m

    r664 r728  
    340340 N TMP,I,J,QXPATH
    341341 S FIRST=1
     342 I '$D(@IARY@(0)) D  ; LINE COUNT NOT IN ZERO NODE
     343 . S @IARY@(0)=$O(@IARY@("//"),-1) ; THIS SHOULD USUALLY WORK
    342344 S LAST=@IARY@(0) ; FIRST AND LAST DEFAULT TO ROOT
    343345 I XPATH'="//" D  ; NOT A ROOT QUERY
     
    461463 I $G(DEBUG) W "DOING INSERT ",INSXML,INSNEW,INSXPATH,!
    462464 I $G(DEBUG) F G1=1:1:@INSXML@(0) W @INSXML@(G1),!
    463  I '$D(@INSXML@(0)) D  ; INSERT INTO AN EMPTY ARRAY
     465 I '$D(@INSXML@(1)) D  ; INSERT INTO AN EMPTY ARRAY
    464466 . D CP^C0CXPATH(INSNEW,INSXML) ; JUST COPY INTO THE OUTPUT
    465  I $D(@INSXML@(0)) D  ; IF ORIGINAL ARRAY IS NOT EMPTY
     467 I $D(@INSXML@(1)) D  ; IF ORIGINAL ARRAY IS NOT EMPTY
     468 . I '$D(@INSXML@(0)) S @INSXML@(0)=$O(@INSXML@(""),-1) ;SET LENGTH
    466469 . I $D(INSXPATH) D  ; XPATH PROVIDED
    467470 . . D QOPEN("INSBLD",INSXML,INSXPATH) ; COPY THE BEFORE
     
    469472 . I '$D(INSXPATH) D  ; NO XPATH PROVIDED, OPEN AT ROOT
    470473 . . D QOPEN("INSBLD",INSXML,"//") ; OPEN WITH ROOT XPATH
     474 . I '$D(@INSNEW@(0)) S @INSNEW@(0)=$O(@INSNEW@(""),-1) ;SIZE OF XML
    471475 . D QUEUE("INSBLD",INSNEW,1,@INSNEW@(0)) ; COPY IN NEW XML
    472476 . I $D(INSXPATH) D  ; XPATH PROVIDED
     
    527531 . D QUEUE("REBLD",REXML,XLAST+1,@REXML@(0)) ; THE REST
    528532 I $G(DEBUG) W "REPLACE PREBUILD",!
     533 I $G(DEBUG) D PARY("REBLD")
     534 D BUILD("REBLD","RTMP")
     535 K @REXML ; KILL WHAT WAS THERE
     536 D CP("RTMP",REXML) ; COPY IN THE RESULT
     537 Q
     538 ;
     539DELETE(REXML,REXPATH)      ; DELETE THE XML AT THE XPATH POINT
     540 ; REXML IS PASSED BY NAME XPATH IS A VALUE
     541 N REBLD,XFIRST,XLAST,OLD,XNODE,RETMP
     542 S OLD=$NA(^TMP($J,"REPLACE_OLD"))
     543 D QUERY(REXML,REXPATH,OLD) ; CREATE INDEX, TEST XPATH, MAKE OLD
     544 S XNODE=@REXML@(REXPATH) ; PULL OUT FIRST AND LAST LINE PTRS
     545 S XFIRST=$P(XNODE,"^",1)
     546 S XLAST=$P(XNODE,"^",2)
     547 D QUEUE("REBLD",REXML,1,XFIRST-1) ; THE BEFORE
     548 D QUEUE("REBLD",REXML,XLAST+1,@REXML@(0)) ; THE REST
    529549 I $G(DEBUG) D PARY("REBLD")
    530550 D BUILD("REBLD","RTMP")
Note: See TracChangeset for help on using the changeset viewer.