Changeset 557


Ignore:
Timestamp:
Sep 8, 2009, 8:29:22 PM (15 years ago)
Author:
George Lilly
Message:

addition of multiples in XPATH generation

File:
1 edited

Legend:

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

    r532 r557  
    226226 I $D(VDX) S DVDX=1 ; IF NAME PASSED, DO VDX
    227227 S C0CSTK(0)=0 ; INITIALIZE STACK
     228 D MKLASD(.LKASD,IZXML) ;MAKE LOOK ASIDE BUFFER FOR MULTIPLES
    228229 F I=1:1:LCNT  D  ; PROCESS THE ENTIRE ARRAY
    229230 . S LINE=@IZXML@(I)
     
    240241 . . . S FOUND=1  ; SET FOUND FLAG
    241242 . . . S CUR=$$XNAME(LINE) ; EXTRACT THE NAME
     243 . . . S CUR=CUR_$G(LKASD(CUR,I)) ; HANDLE MULTIPLES
    242244 . . . D PUSH("C0CSTK",CUR) ; ADD TO THE STACK
    243245 . . . D MKMDX("C0CSTK",.MDX) ; GENERATE THE M INDEX
     
    267269 . . . S $P(@ZXML@(MDX),"^",2)=I ; UPDATE LAST LINE NUMBER
    268270 . . . D POP("C0CSTK",.TMP) ; REMOVE FROM STACK
     271 . . . S TMP=$P(TMP,"[",1) ; REMOVE [X] FROM MULTIPLE
    269272 . . . I TMP'=CUR  D  ; MALFORMED XML, END MUST MATCH START
    270273 . . . . W "MALFORMED XML ",CUR,"LINE "_I_LINE,!
     
    276279 . . . S FOUND=1  ; SET FOUND FLAG
    277280 . . . S CUR=$$XNAME(LINE) ; EXTRACT THE NAME
     281 . . . S CUR=CUR_$G(LKASD(CUR,I)) ; HANDLE MULTIPLES
    278282 . . . D PUSH("C0CSTK",CUR) ; ADD TO THE STACK
    279283 . . . D MKMDX("C0CSTK",.MDX) ; GENERATE THE M INDEX
     
    281285 . . . I $D(@ZXML@(MDX))  D  ; IN THE INDEX, IS A MULTIPLE
    282286 . . . . S $P(@ZXML@(MDX),"^",2)=I ; UPDATE LAST LINE NUMBER
     287 . . . . ;B
    283288 . . . I '$D(@ZXML@(MDX))  D  ; NOT IN THE INDEX, NOT A MULTIPLE
    284289 . . . . S @ZXML@(MDX)=I_"^" ; INSERT INTO THE INDEX
     
    286291 S @ZXML@("//")="1^"_LCNT ; ROOT XPATH
    287292 I NOINX K @ZXML ; DELETE UNWANTED INDEX
     293 Q
     294 ;
     295MKLASD(OUTBUF,INARY) ; CREATE A LOOKASIDE BUFFER FOR MULTILPLES
     296 ;
     297 N ZI,ZN,ZA,ZLINE,ZLINE2,CUR,CUR2
     298 F ZI=1:1:LCNT-1  D  ; PROCESS THE ENTIRE ARRAY
     299 . S ZLINE=@IZXML@(ZI)
     300 . I ZI<LCNT S ZLINE2=@IZXML@(ZI+1)
     301 . I ZLINE?.E1"</"1.E  D  ; NEXT LINE CONTAINS END OF A SECTION
     302 . . S CUR=$$XNAME(ZLINE) ; EXTRACT THE NAME
     303 . . I (ZLINE2?.E1"<"1.E)&(ZLINE'["?>")  D  ; BEGINNING OF A SECTION
     304 . . . S CUR2=$$XNAME(ZLINE2) ; EXTRACT THE NAME
     305 . . . I CUR=CUR2 D  ; IF THIS IS A MULTIPLE
     306 . . . . S OUTBUF(CUR,ZI+1)=""
     307 ;ZWR OUTBUF
     308 S ZI=""
     309 F  S ZI=$O(OUTBUF(ZI)) Q:ZI=""  D  ; FOR EACH KIND OF MULTIPLE
     310 . S ZN=$O(OUTBUF(ZI,"")) ; LINE NUMBER OF SECOND MULTIPLE
     311 . F  S ZN=$O(@IZXML@(ZN),-1) Q:ZN=""  I $P(@IZXML@(ZN),"<"_ZI,2)=">" Q  ;
     312 . S OUTBUF(ZI,ZN)=""
     313 S ZA=1,ZI="",ZN=""
     314 F  S ZI=$O(OUTBUF(ZI)) Q:ZI=""  D  ; ADDING THE COUNT FOR THE MULIPLES [x]
     315 . S ZN="",ZA=1
     316 . F  S ZN=$O(OUTBUF(ZI,ZN)) Q:ZN=""  D  ;
     317 . . S OUTBUF(ZI,ZN)="["_ZA_"]"
     318 . . S ZA=ZA+1
    288319 Q
    289320 ;
Note: See TracChangeset for help on using the changeset viewer.