Changeset 74 for ccr/trunk/p/GPLXPATH.m
- Timestamp:
- Jul 25, 2008, 10:01:34 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ccr/trunk/p/GPLXPATH.m
r60 r74 332 332 Q 333 333 ; 334 MAP (IXML,INARY,OXML) ; SUBSTITUTE @@X@@ VARS IN IXML WITH VALUES IN INARY334 MAPOLD(IXML,INARY,OXML) ; SUBSTITUTE @@X@@ VARS IN IXML WITH VALUES IN INARY 335 335 ; AND PUT THE RESULTS IN OXML 336 336 I '$D(@IXML@(0)) W "MALFORMED XML PASSED TO MAP",! Q … … 345 345 . . . S TVAL=@INARY@(TNAM) ; PULL OUT MAPPED VALUE 346 346 . . . S @OXML@(I)=$P(@OXML@(I),"@@",1)_TVAL_$P(@OXML@(I),"@@",3) 347 W "MAPPED",! 348 Q 349 ; 350 MAP(IXML,INARY,OXML) ; SUBSTITUTE MULTIPLE @@X@@ VARS WITH VALUES IN INARY 351 ; AND PUT THE RESULTS IN OXML 352 I '$D(@IXML@(0)) W "MALFORMED XML PASSED TO MAP",! Q 353 I $O(@INARY@(""))="" W "EMPTY ARRAY PASSED TO MAP",! Q 354 N I,J,TNAM,TVAL,TSTR 355 S @OXML@(0)=@IXML@(0) ; TOTAL LINES IN OUTPUT 356 F I=1:1:@OXML@(0) D ; LOOP THROUGH WHOLE ARRAY 357 . S @OXML@(I)=@IXML@(I) ; COPY THE LINE TO OUTPUT 358 . I @OXML@(I)?.E1"@@".E D ; IS THERE A VARIABLE HERE? 359 . . S TSTR=$P(@IXML@(I),"@@",1) ; INIT TO PART BEFORE VARS 360 . . F J=2:2:10 D Q:$P(@IXML@(I),"@@",J+2)="" ; QUIT IF NO MORE VARS 361 . . . W "IN MAPPING LOOP: ",TSTR,! 362 . . . S TNAM=$P(@OXML@(I),"@@",J) ; EXTRACT THE VARIABLE NAME 363 . . . S TVAL="" ; DEFAULT FOR UNMAPPED VARIABLES 364 . . . I $D(@INARY@(TNAM)) D ; IS THE VARIABLE IN THE MAP? 365 . . . . S TVAL=@INARY@(TNAM) ; PULL OUT MAPPED VALUE 366 . . . S TSTR=TSTR_TVAL_$P(@IXML@(I),"@@",J+1) ; ADD VAR AND PART AFTER 367 . . S @OXML@(I)=TSTR ; COPY LINE WITH MAPPED VALUES 368 . . W TSTR 347 369 W "MAPPED",! 348 370 Q … … 504 526 ;;>>>D MAP^GPLXPATH("GXML",MAPARY,OUTARY) 505 527 ;;>>?@OUTARY@(6)="VALUE2" 528 ;;><MAP2> 529 ;;>>>D ZTEST^GPLXPATH("INITXML") 530 ;;>>>S MAPARY="^TMP($J,""MAPVALUES"")" 531 ;;>>>S OUTARY="^TMP($J,""MAPTEST"")" 532 ;;>>>S @MAPARY@("DATA1")="VALUE1" 533 ;;>>>S @MAPARY@("DATA2")="VALUE2" 534 ;;>>>S @MAPARY@("DATA3")="VALUE3" 535 ;;>>>S GXML(4)="<FOURTH>@@DATA1@@ AND @@DATA3@@</FOURTH>" 536 ;;>>>D MAP^GPLXPATH("GXML",MAPARY,OUTARY) 537 ;;>>>D PARY^GPLXPATH(OUTARY) 538 ;;>>?@OUTARY@(4)="<FOURTH>VALUE1 AND VALUE3</FOURTH>" 506 539 ;;><QUEUE> 507 540 ;;>>>D QUEUE^GPLXPATH("BTLIST","GXML",2,3)
Note:
See TracChangeset
for help on using the changeset viewer.