Changeset 649


Ignore:
Timestamp:
Dec 15, 2009, 6:18:32 PM (15 years ago)
Author:
George Lilly
Message:

compiling xml templates

File:
1 edited

Legend:

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

    r648 r649  
    2626 S @ARY@("XML TEMPLATE FIELD")=3
    2727 S @ARY@("XPATH BINDING SUBFILE")=178.1014
     28 S @ARY@("REDUX FIELD")=2.5
    2829 Q
    2930 ;
     
    3435 S C0CXTFLD=@ARY@("XML TEMPLATE FIELD")
    3536 S C0CXPBF=@ARY@("XPATH BINDING SUBFILE")
     37 S C0CRDUXF=@ARY@("REDUX FIELD")
    3638 Q
    3739 ;
     
    7779 Q
    7880 ;
    79 MKTPLATE(OUTT,INXML,REDUX) ;MAKE A TEMPLATE FROM INXML, RETURNED IN OUTT
    80  ; BOTH PASSED BY NAME
     81COMPILE(INTID,UFARY) ; COMPILES AN XML TEMPLATE AND GENERATES XPATH BINDINGS
     82 ; UFARY IF SPECIFIED WILL REDIRECT THE XML FILE TO USE
     83 ; INTID IS THE IEN OF THE RECORD TO USE IN THE XML FILE
     84 ; XML IS PULLED FROM THE "XML" FIELD AND THE COMPILED RESULT PUT
     85 ; IN THE "XML TEMPLATE" FIELD. ALL XPATHS USED IN THE TEMPLATE
     86 ; WILL BE POPULATED TO THE XPATH BINDINGS SUBFILE AS .01
     87 I '$D(UFARY) D  ;
     88 . S UFARY="UFARY" ; FILE ARRAY
     89 . D INITXPF("UFARY") ;IF FILE ARRAY NOT PASSED, INITIALIZE
     90 D SETXPF(UFARY) ;SET FILE VARIABLES
     91 B
     92 ;N C0CXML,C0CREDUX,C0CTEMP,C0CIDX
     93 D GETXML("C0CXML",INTID,UFARY)
     94 S C0CREDUX=$$GET1^DIQ(C0CXPF,INTID_",",C0CRDUXF,"E") ;XPATH REDUCTION STRING
     95 D MKTPLATE("C0CTEMP","C0CIDX","C0CXML",C0CREDUX) ; CREATE TEMPLATE AND IDX
     96 D ADDTEMP("C0CTEMP",INTID,UFARY) ; WRITE THE TEMPLATE TO FILE
     97 D ADDXP("C0CIDX",INTID,UFARY) ;CREATE XPATH SUBFILE ENTRIES FOR EVERY XPATH
     98 Q
     99 ;
     100MKTPLATE(OUTT,OUTIDX,INXML,REDUX) ;MAKE A TEMPLATE FROM INXML, RETURNED IN OUTT
     101 ; BOTH PASSED BY NAME. THE REDUX XPATH REDUCTION STRING IS USED IF PASSED
     102 ; OUTIDX IS AN ARRAY OF THE XPATHS USED IN MAKING THE TEMPLATE
    81103 ;
    82104 S C0CXLOC=$NA(^TMP("C0CXML",$J))
     
    97119 . . W !,ZD(1)
    98120 . . K @C0CDOM@(ZI,"T") ; KILL THE DATA
    99  . . S @C0CDOM@(ZI,"T",1)="@@"_$G(GIDX2(ZI))_"@@"
     121 . . N ZXPATH
     122 . . S ZXPATH=$G(GIDX2(ZI)) ;FIND AN XPATH FOR THIS NODE
     123 . . S @C0CDOM@(ZI,"T",1)="@@"_ZXPATH_"@@"
     124 . . I ZXPATH'="" S @OUTIDX@(ZXPATH)="" ; PASS BACK XPATH USED IN IDX
    100125 D OUTXML^C0CMXML(OUTT,C0CDOCID)
    101126 Q
Note: See TracChangeset for help on using the changeset viewer.