some fixes to the MXML wrapper
This commit is contained in:
parent
dd407fe3ee
commit
81dc035c52
16
p/C0CMXML.m
16
p/C0CMXML.m
|
@ -20,7 +20,9 @@ C0CMXML ; ERX/GPL - MXML based XPath utilities; 10/11/09
|
||||||
Q
|
Q
|
||||||
;
|
;
|
||||||
TEST ;
|
TEST ;
|
||||||
S DOCID=$$PARSE("^GPL")
|
S C0CXMLIN=$NA(^TMP("C0CMXML",$J))
|
||||||
|
W $$FTG^%ZISH("/home/vademo2/EHR/p/","mxml-test.xml",$NA(@C0CXMLIN@(1)),3)
|
||||||
|
S C0CDOCID=$$PARSE(C0CXMLIN)
|
||||||
S REDUX="//ContinuityOfCareRecord/Body"
|
S REDUX="//ContinuityOfCareRecord/Body"
|
||||||
D XPATH(1,"/","GIDX","GARY",,REDUX)
|
D XPATH(1,"/","GIDX","GARY",,REDUX)
|
||||||
Q
|
Q
|
||||||
|
@ -47,7 +49,7 @@ XPATH(ZOID,ZPATH,ZXIDX,ZXPARY,ZNUM,ZREDUX) ; RECURSIVE ROUTINE TO POPULATE
|
||||||
. I GT'="" S NEWPATH=GT
|
. I GT'="" S NEWPATH=GT
|
||||||
S @ZXIDX@(NEWPATH)=ZOID ; ADD THE XPATH FOR THIS NODE TO THE XPATH INDEX
|
S @ZXIDX@(NEWPATH)=ZOID ; ADD THE XPATH FOR THIS NODE TO THE XPATH INDEX
|
||||||
N GD S GD=$$DATA(ZOID) ; SEE IF THERE IS DATA FOR THIS NODE
|
N GD S GD=$$DATA(ZOID) ; SEE IF THERE IS DATA FOR THIS NODE
|
||||||
I GD'=0 S @ZXPARY@(NEWPATH)=GD ; IF YES, ADD IT TO THE XPATH ARRAY
|
I GD'="" S @ZXPARY@(NEWPATH)=GD ; IF YES, ADD IT TO THE XPATH ARRAY
|
||||||
N ZFRST S ZFRST=$$FIRST(ZOID) ; SET FIRST CHILD
|
N ZFRST S ZFRST=$$FIRST(ZOID) ; SET FIRST CHILD
|
||||||
I ZFRST'=0 D ; THERE IS A CHILD
|
I ZFRST'=0 D ; THERE IS A CHILD
|
||||||
. N ZMULT S ZMULT=$$ISMULT(ZFRST) ; IS FIRST CHILD A MULTIPLE
|
. N ZMULT S ZMULT=$$ISMULT(ZFRST) ; IS FIRST CHILD A MULTIPLE
|
||||||
|
@ -70,17 +72,19 @@ ISMULT(ZOID) ; RETURN TRUE IF ZOID IS ONE OF A MULTIPLE
|
||||||
Q 0
|
Q 0
|
||||||
;
|
;
|
||||||
FIRST(ZOID) ;RETURNS THE OID OF THE FIRST CHILD OF ZOID
|
FIRST(ZOID) ;RETURNS THE OID OF THE FIRST CHILD OF ZOID
|
||||||
Q $$CHILD^MXMLDOM(DOCID,ZOID)
|
Q $$CHILD^MXMLDOM(C0CDOCID,ZOID)
|
||||||
;
|
;
|
||||||
TAG(ZOID) ; RETURNS THE XML TAG FOR THE NODE
|
TAG(ZOID) ; RETURNS THE XML TAG FOR THE NODE
|
||||||
Q $$NAME^MXMLDOM(DOCID,ZOID)
|
Q $$NAME^MXMLDOM(C0CDOCID,ZOID)
|
||||||
;
|
;
|
||||||
NXTSIB(ZOID) ; RETURNS THE NEXT SIBLING
|
NXTSIB(ZOID) ; RETURNS THE NEXT SIBLING
|
||||||
Q $$SIBLING^MXMLDOM(DOCID,ZOID)
|
Q $$SIBLING^MXMLDOM(C0CDOCID,ZOID)
|
||||||
;
|
;
|
||||||
DATA(ZOID) ; RETURNS DATA FOR THE NODE
|
DATA(ZOID) ; RETURNS DATA FOR THE NODE
|
||||||
N ZT,ZN S ZT=""
|
N ZT,ZN S ZT=""
|
||||||
S ZN=$$TEXT^MXMLDOM(DOCID,ZOID,"ZT")
|
S C0CDOM=$NA(^TMP("MXMLDOM",$J,C0CDOCID))
|
||||||
|
Q $G(@C0CDOM@(ZOID,"T",1))
|
||||||
|
S ZN=$$TEXT^MXMLDOM(C0CDOCID,ZOID,"ZT")
|
||||||
I $G(ZT) ZWR ZT
|
I $G(ZT) ZWR ZT
|
||||||
Q $G(ZT)
|
Q $G(ZT)
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in New Issue