compiling xml templates
This commit is contained in:
parent
fac7922749
commit
d3ceb8430c
31
p/C0CMXP.m
31
p/C0CMXP.m
|
@ -25,6 +25,7 @@ INITXPF(ARY) ;INITIAL XML/XPATH FILE ARRAY
|
|||
S @ARY@("XML SOURCE FIELD")=2.1
|
||||
S @ARY@("XML TEMPLATE FIELD")=3
|
||||
S @ARY@("XPATH BINDING SUBFILE")=178.1014
|
||||
S @ARY@("REDUX FIELD")=2.5
|
||||
Q
|
||||
;
|
||||
SETXPF(ARY) ; SET FILE AND FIELD VARIABLES FROM XPF ARRAY
|
||||
|
@ -33,6 +34,7 @@ SETXPF(ARY) ; SET FILE AND FIELD VARIABLES FROM XPF ARRAY
|
|||
S C0CXFLD=@ARY@("XML SOURCE FIELD")
|
||||
S C0CXTFLD=@ARY@("XML TEMPLATE FIELD")
|
||||
S C0CXPBF=@ARY@("XPATH BINDING SUBFILE")
|
||||
S C0CRDUXF=@ARY@("REDUX FIELD")
|
||||
Q
|
||||
;
|
||||
ADDXP(INARY,TID,FARY) ;ADD XPATH .01 FIELD TO BINDING SUBFILE OF TEMPLATE TID
|
||||
|
@ -76,8 +78,28 @@ GETXML(OUTXML,TEMPID,FARY) ;GET THE XML FROM TEMPLATE TEMPID
|
|||
. W "ERROR RETRIEVING TEMPLATE",!
|
||||
Q
|
||||
;
|
||||
MKTPLATE(OUTT,INXML,REDUX) ;MAKE A TEMPLATE FROM INXML, RETURNED IN OUTT
|
||||
; BOTH PASSED BY NAME
|
||||
COMPILE(INTID,UFARY) ; COMPILES AN XML TEMPLATE AND GENERATES XPATH BINDINGS
|
||||
; UFARY IF SPECIFIED WILL REDIRECT THE XML FILE TO USE
|
||||
; INTID IS THE IEN OF THE RECORD TO USE IN THE XML FILE
|
||||
; XML IS PULLED FROM THE "XML" FIELD AND THE COMPILED RESULT PUT
|
||||
; IN THE "XML TEMPLATE" FIELD. ALL XPATHS USED IN THE TEMPLATE
|
||||
; WILL BE POPULATED TO THE XPATH BINDINGS SUBFILE AS .01
|
||||
I '$D(UFARY) D ;
|
||||
. S UFARY="UFARY" ; FILE ARRAY
|
||||
. D INITXPF("UFARY") ;IF FILE ARRAY NOT PASSED, INITIALIZE
|
||||
D SETXPF(UFARY) ;SET FILE VARIABLES
|
||||
B
|
||||
;N C0CXML,C0CREDUX,C0CTEMP,C0CIDX
|
||||
D GETXML("C0CXML",INTID,UFARY)
|
||||
S C0CREDUX=$$GET1^DIQ(C0CXPF,INTID_",",C0CRDUXF,"E") ;XPATH REDUCTION STRING
|
||||
D MKTPLATE("C0CTEMP","C0CIDX","C0CXML",C0CREDUX) ; CREATE TEMPLATE AND IDX
|
||||
D ADDTEMP("C0CTEMP",INTID,UFARY) ; WRITE THE TEMPLATE TO FILE
|
||||
D ADDXP("C0CIDX",INTID,UFARY) ;CREATE XPATH SUBFILE ENTRIES FOR EVERY XPATH
|
||||
Q
|
||||
;
|
||||
MKTPLATE(OUTT,OUTIDX,INXML,REDUX) ;MAKE A TEMPLATE FROM INXML, RETURNED IN OUTT
|
||||
; BOTH PASSED BY NAME. THE REDUX XPATH REDUCTION STRING IS USED IF PASSED
|
||||
; OUTIDX IS AN ARRAY OF THE XPATHS USED IN MAKING THE TEMPLATE
|
||||
;
|
||||
S C0CXLOC=$NA(^TMP("C0CXML",$J))
|
||||
K @C0CXLOC
|
||||
|
@ -96,7 +118,10 @@ MKTPLATE(OUTT,INXML,REDUX) ;MAKE A TEMPLATE FROM INXML, RETURNED IN OUTT
|
|||
. I $D(ZD(1)) D ; IF YES
|
||||
. . W !,ZD(1)
|
||||
. . K @C0CDOM@(ZI,"T") ; KILL THE DATA
|
||||
. . S @C0CDOM@(ZI,"T",1)="@@"_$G(GIDX2(ZI))_"@@"
|
||||
. . N ZXPATH
|
||||
. . S ZXPATH=$G(GIDX2(ZI)) ;FIND AN XPATH FOR THIS NODE
|
||||
. . S @C0CDOM@(ZI,"T",1)="@@"_ZXPATH_"@@"
|
||||
. . I ZXPATH'="" S @OUTIDX@(ZXPATH)="" ; PASS BACK XPATH USED IN IDX
|
||||
D OUTXML^C0CMXML(OUTT,C0CDOCID)
|
||||
Q
|
||||
;
|
||||
|
|
Loading…
Reference in New Issue