XHDPEDIT ; SLC/JER - Configuration Editor Server Calls ; 25 Jul 2003 9:42 AM
;;1.0;HEALTHEVET DESKTOP;;Jul 15, 2003
GETTREE(XHDCY,XHDMOD) ; Control Branching
N XHDCI,XHDCDA
S XHDCI=0,XHDCDA=+$O(^XHD(8935.91,"AMROOT",XHDMOD,0))
S XHDCY=$NA(^TMP("XHDPTREE",$J)) K @XHDCY
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<?xml version=""1.0"" encoding=""UTF-8""?>"
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<getConfigurationCallResult"
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"""
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="xsi:noNamespaceSchemaLocation=""C:\reeng\main\modules\config\src\gov\va\med\hds\cd\config\xml\configTree.xsd"">"
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<configTree>"
D GETCAT(XHDCY,XHDCDA,.XHDCI)
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</configTree>"
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</getConfigurationCallResult>"
S XHDCY=$NA(^TMP("XHDPTREE",$J,"XMLDOC"))
Q
FLDS() ; Get field string
Q ".01:1"
GETCAT(XHDCY,XHDCDA,XHDCI) ; Loads Top-level Fields
N XHDCF,XHDKI,PCATAG S XHDCF=0
S PCATAG=$S($$ISROOT(XHDCDA):"pluginParameterCategory",1:"parameterCategory")
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<"_PCATAG_">"
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<id>"_XHDCDA_"</id>"
D GETS^DIQ(8935.91,XHDCDA_",",$$FLDS,"IE",XHDCY)
F S XHDCF=$O(@XHDCY@(8935.91,XHDCDA_",",XHDCF)) Q:XHDCF'>0 D
. N TAG,VAL
. S TAG=$TR($$FLDNAME(XHDCF,8935.91)," /","")
. S VAL=$G(@XHDCY@(8935.91,XHDCDA_",",XHDCF,$S(XHDCF=.04:"I",1:"E")))
. I XHDCF=.04 S VAL=+VAL
. S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<"_TAG_">"_VAL_"</"_TAG_">"
K @XHDCY@(8935.91)
;** get parameters **
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<parameters>"
D GETPARAM(XHDCY,XHDCDA,.XHDCI)
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</parameters>"
S XHDKI=0
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<children>"
F S XHDKI=$O(^XHD(8935.91,XHDCDA,3,XHDKI)) Q:+XHDKI'>0 D
. N XHDKID S XHDKID=$P($G(^XHD(8935.91,XHDCDA,3,XHDKI,0)),U,2)
. D GETCAT(XHDCY,XHDKID,.XHDCI)
;S XHDKI=0
;F S XHDKI=$O(^XHD(8935.91,XHDCDA,2,XHDKI)) Q:+XHDKI'>0 D
;. N XHDPARAM S XHDPARAM=$P($G(^XHD(8935.91,XHDCDA,2,XHDKI,0)),U,2)
;. D GETLEAF(XHDCY,XHDPARAM,XHDCDA,.XHDCI)
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</children>"
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</"_PCATAG_">"
Q
GETLEAF(XHDCY,PAR,PID,XHDCI) ; Build Leafnode categories
N FULLNAME,PLUGINID,NAME,PARAM0,PCAT0
S PARAM0=$G(^XTV(8989.51,PAR,0)),PCAT0=$G(^XHD(8935.91,PID,0))
S FULLNAME=$$ESCAPE^XHDLXM($P(PARAM0,U)),NAME=$$ESCAPE^XHDLXM($P(PARAM0,U,2))
S PLUGINID=$P(PCAT0,U,2)
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<parameterCategory>"
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<id/>"
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<fullName>"_FULLNAME_"</fullName>"
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<pluginId>"_PLUGINID_"</pluginId>"
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<name/>"_NAME_"</name>"
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<parentId/>"_PID_"</parentId>"
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<packageRoot/>false</packageRoot>"
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<preferencePage/>"
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<leaf>true</leaf>"
;** get parameters **
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<parameters>"
D GETPARAM(XHDCY,XHDCDA,.XHDCI)
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</parameters>"
S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</parameterCategory>"
Q
ISROOT(XHDCDA) ; Boolean - is record plugin root?
Q +$P($G(^XHD(8935.91,XHDCDA,0)),U,5)
FLDNAME(XHDCFN,FILENUM) ; Resolve field names
Q $$MIXED($P($G(^DD(FILENUM,XHDCFN,0)),U))
MIXED(X) ; Return Mixed Case X
N ORI,WORD,TMP
S TMP="" F ORI=1:1:$L(X," ") S WORD=$$LOW^XLFSTR($P(X," ",ORI)),$E(WORD)=$S(ORI=1:$E(WORD),1:$$UP^XLFSTR($E(WORD))),TMP=$S(TMP="":WORD,1:TMP_WORD)
Q TMP
GETPARAM(XHDCY,XHDCDA,XHDCI) ; Loads Parameters
N ORI S ORI=0
F S ORI=$O(^XHD(8935.91,XHDCDA,2,ORI)) Q:+ORI'>0 D
. N PNODE,FULLNAME,MULTIVAL,WORDPROC,PAR,PARDEF0,PARDEF1,DNAME,VDTYPE,READONLY
. S PNODE=$G(^XHD(8935.91,XHDCDA,2,ORI,0))
. Q:PNODE']""
. S PAR=$P(PNODE,U,2),PARDEF0=$G(^XTV(8989.51,PAR,0)),PARDEF1=$G(^(1))
. S FULLNAME=$P(PARDEF0,U),DNAME=$P(PARDEF0,U,2),VDTYPE=$P(PARDEF1,U)
. S READONLY=$S(+$P(PARDEF0,U,6):"true",1:"false")
. S MULTIVAL=$S(+$P(PARDEF0,U,3):"true",1:"false")
. S WORDPROC=$S(VDTYPE="W":"true",1:"false")
. N PLIST,ERR
. D GETLST^XHDPAR(.PLIST,PAR,.ERR)
. I 'ERR D
. . N ORJ S ORJ=0
. . F S ORJ=$O(PLIST(ORJ)) Q:+ORJ'>0 D
. . . N KEY,ENT,INST,VAL,NAME,EXTENT
. . . S NAME=$$ESCAPE^XHDLXM(DNAME)
. . . S ENT=$P(PLIST(ORJ),U),EXTENT=$P(PLIST(ORJ),U,2)
. . . S INST=$P(PLIST(ORJ),U,3),VAL=$P(PLIST(ORJ),U,4)
. . . S:(MULTIVAL="true") NAME=NAME_" "_INST
. . . S KEY=NAME_U_ENT_U_PAR_U_INST
. . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<parameter>"
. . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<id>"_PAR_"</id>"
. . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<name>"_NAME_"</name>"
. . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<fullName>"_$$ESCAPE^XHDLXM(FULLNAME)_"</fullName>"
. . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<key>"_KEY_"</key>"
. . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<readOnly>"_READONLY_"</readOnly>"
. . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<extEntity>"_EXTENT_"</extEntity>"
. . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<multiValued>"_MULTIVAL_"</multiValued>"
. . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<wordProcessing>"_WORDPROC_"</wordProcessing>"
. . . ; If wp, call for wp result
. . . I (WORDPROC="true") D
. . . . N VALIST,ERR
. . . . D GETWP^XPAR(.VALIST,"ALL^"_$P(KEY,U,2),PAR,INST,.ERR)
. . . . I 'ERR D
. . . . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<value>"
. . . . . N ORK S ORK=0
. . . . . F S ORK=$O(VALIST(ORK)) Q:+ORK'>0 D
. . . . . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)=$$ESCAPE^XHDLXM($G(VALIST(ORK,0)))
. . . . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</value>"
. . . . N DFLIST,ERR
. . . . D GETWP^XPAR(.DFLIST,"PKG",PAR,INST,.ERR)
. . . . I 'ERR D
. . . . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<defaultValue>"
. . . . . N ORK S ORK=0
. . . . . F S ORK=$O(VALIST(ORK)) Q:+ORK'>0 D
. . . . . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)=$$ESCAPE^XHDLXM($G(VALIST(ORK,0)))
. . . . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</defaultValue>"
. . . E D
. . . . N DVAL S DVAL=$$GET^XPAR("PKG",PAR,INST,$S(VDTYPE="D":"Q",1:"E"))
. . . . S VAL=$$XFORM^XHDPTREE(VAL,VDTYPE)
. . . . S DVAL=$$XFORM^XHDPTREE(DVAL,VDTYPE)
. . . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<value>"_$$ESCAPE^XHDLXM(VAL)_"</value>"
. . . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="<defaultValue>"_$$ESCAPE^XHDLXM(DVAL)_"</defaultValue>"
. . . S XHDCI=XHDCI+1,@XHDCY@("XMLDOC",XHDCI)="</parameter>"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXHDPEDIT 6909 printed Dec 13, 2024@01:57:20 Page 2
XHDPEDIT ; SLC/JER - Configuration Editor Server Calls ; 25 Jul 2003 9:42 AM
+1 ;;1.0;HEALTHEVET DESKTOP;;Jul 15, 2003
GETTREE(XHDCY,XHDMOD) ; Control Branching
+1 NEW XHDCI,XHDCDA
+2 SET XHDCI=0
SET XHDCDA=+$ORDER(^XHD(8935.91,"AMROOT",XHDMOD,0))
+3 SET XHDCY=$NAME(^TMP("XHDPTREE",$JOB))
KILL @XHDCY
+4 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<?xml version=""1.0"" encoding=""UTF-8""?>"
+5 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<getConfigurationCallResult"
+6 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"""
+7 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="xsi:noNamespaceSchemaLocation=""C:\reeng\main\modules\config\src\gov\va\med\hds\cd\config\xml\configTree.xsd"">"
+8 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<configTree>"
+9 DO GETCAT(XHDCY,XHDCDA,.XHDCI)
+10 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="</configTree>"
+11 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="</getConfigurationCallResult>"
+12 SET XHDCY=$NAME(^TMP("XHDPTREE",$JOB,"XMLDOC"))
+13 QUIT
FLDS() ; Get field string
+1 QUIT ".01:1"
GETCAT(XHDCY,XHDCDA,XHDCI) ; Loads Top-level Fields
+1 NEW XHDCF,XHDKI,PCATAG
SET XHDCF=0
+2 SET PCATAG=$SELECT($$ISROOT(XHDCDA):"pluginParameterCategory",1:"parameterCategory")
+3 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<"_PCATAG_">"
+4 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<id>"_XHDCDA_"</id>"
+5 DO GETS^DIQ(8935.91,XHDCDA_",",$$FLDS,"IE",XHDCY)
+6 FOR
SET XHDCF=$ORDER(@XHDCY@(8935.91,XHDCDA_",",XHDCF))
if XHDCF'>0
QUIT
Begin DoDot:1
+7 NEW TAG,VAL
+8 SET TAG=$TRANSLATE($$FLDNAME(XHDCF,8935.91)," /","")
+9 SET VAL=$GET(@XHDCY@(8935.91,XHDCDA_",",XHDCF,$SELECT(XHDCF=.04:"I",1:"E")))
+10 IF XHDCF=.04
SET VAL=+VAL
+11 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<"_TAG_">"_VAL_"</"_TAG_">"
End DoDot:1
+12 KILL @XHDCY@(8935.91)
+13 ;** get parameters **
+14 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<parameters>"
+15 DO GETPARAM(XHDCY,XHDCDA,.XHDCI)
+16 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="</parameters>"
+17 SET XHDKI=0
+18 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<children>"
+19 FOR
SET XHDKI=$ORDER(^XHD(8935.91,XHDCDA,3,XHDKI))
if +XHDKI'>0
QUIT
Begin DoDot:1
+20 NEW XHDKID
SET XHDKID=$PIECE($GET(^XHD(8935.91,XHDCDA,3,XHDKI,0)),U,2)
+21 DO GETCAT(XHDCY,XHDKID,.XHDCI)
End DoDot:1
+22 ;S XHDKI=0
+23 ;F S XHDKI=$O(^XHD(8935.91,XHDCDA,2,XHDKI)) Q:+XHDKI'>0 D
+24 ;. N XHDPARAM S XHDPARAM=$P($G(^XHD(8935.91,XHDCDA,2,XHDKI,0)),U,2)
+25 ;. D GETLEAF(XHDCY,XHDPARAM,XHDCDA,.XHDCI)
+26 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="</children>"
+27 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="</"_PCATAG_">"
+28 QUIT
GETLEAF(XHDCY,PAR,PID,XHDCI) ; Build Leafnode categories
+1 NEW FULLNAME,PLUGINID,NAME,PARAM0,PCAT0
+2 SET PARAM0=$GET(^XTV(8989.51,PAR,0))
SET PCAT0=$GET(^XHD(8935.91,PID,0))
+3 SET FULLNAME=$$ESCAPE^XHDLXM($PIECE(PARAM0,U))
SET NAME=$$ESCAPE^XHDLXM($PIECE(PARAM0,U,2))
+4 SET PLUGINID=$PIECE(PCAT0,U,2)
+5 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<parameterCategory>"
+6 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<id/>"
+7 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<fullName>"_FULLNAME_"</fullName>"
+8 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<pluginId>"_PLUGINID_"</pluginId>"
+9 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<name/>"_NAME_"</name>"
+10 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<parentId/>"_PID_"</parentId>"
+11 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<packageRoot/>false</packageRoot>"
+12 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<preferencePage/>"
+13 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<leaf>true</leaf>"
+14 ;** get parameters **
+15 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<parameters>"
+16 DO GETPARAM(XHDCY,XHDCDA,.XHDCI)
+17 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="</parameters>"
+18 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="</parameterCategory>"
+19 QUIT
ISROOT(XHDCDA) ; Boolean - is record plugin root?
+1 QUIT +$PIECE($GET(^XHD(8935.91,XHDCDA,0)),U,5)
FLDNAME(XHDCFN,FILENUM) ; Resolve field names
+1 QUIT $$MIXED($PIECE($GET(^DD(FILENUM,XHDCFN,0)),U))
MIXED(X) ; Return Mixed Case X
+1 NEW ORI,WORD,TMP
+2 SET TMP=""
FOR ORI=1:1:$LENGTH(X," ")
SET WORD=$$LOW^XLFSTR($PIECE(X," ",ORI))
SET $EXTRACT(WORD)=$SELECT(ORI=1:$EXTRACT(WORD),1:$$UP^XLFSTR($EXTRACT(WORD)))
SET TMP=$SELECT(TMP="":WORD,1:TMP_WORD)
+3 QUIT TMP
GETPARAM(XHDCY,XHDCDA,XHDCI) ; Loads Parameters
+1 NEW ORI
SET ORI=0
+2 FOR
SET ORI=$ORDER(^XHD(8935.91,XHDCDA,2,ORI))
if +ORI'>0
QUIT
Begin DoDot:1
+3 NEW PNODE,FULLNAME,MULTIVAL,WORDPROC,PAR,PARDEF0,PARDEF1,DNAME,VDTYPE,READONLY
+4 SET PNODE=$GET(^XHD(8935.91,XHDCDA,2,ORI,0))
+5 if PNODE']""
QUIT
+6 SET PAR=$PIECE(PNODE,U,2)
SET PARDEF0=$GET(^XTV(8989.51,PAR,0))
SET PARDEF1=$GET(^(1))
+7 SET FULLNAME=$PIECE(PARDEF0,U)
SET DNAME=$PIECE(PARDEF0,U,2)
SET VDTYPE=$PIECE(PARDEF1,U)
+8 SET READONLY=$SELECT(+$PIECE(PARDEF0,U,6):"true",1:"false")
+9 SET MULTIVAL=$SELECT(+$PIECE(PARDEF0,U,3):"true",1:"false")
+10 SET WORDPROC=$SELECT(VDTYPE="W":"true",1:"false")
+11 NEW PLIST,ERR
+12 DO GETLST^XHDPAR(.PLIST,PAR,.ERR)
+13 IF 'ERR
Begin DoDot:2
+14 NEW ORJ
SET ORJ=0
+15 FOR
SET ORJ=$ORDER(PLIST(ORJ))
if +ORJ'>0
QUIT
Begin DoDot:3
+16 NEW KEY,ENT,INST,VAL,NAME,EXTENT
+17 SET NAME=$$ESCAPE^XHDLXM(DNAME)
+18 SET ENT=$PIECE(PLIST(ORJ),U)
SET EXTENT=$PIECE(PLIST(ORJ),U,2)
+19 SET INST=$PIECE(PLIST(ORJ),U,3)
SET VAL=$PIECE(PLIST(ORJ),U,4)
+20 if (MULTIVAL="true")
SET NAME=NAME_" "_INST
+21 SET KEY=NAME_U_ENT_U_PAR_U_INST
+22 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<parameter>"
+23 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<id>"_PAR_"</id>"
+24 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<name>"_NAME_"</name>"
+25 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<fullName>"_$$ESCAPE^XHDLXM(FULLNAME)_"</fullName>"
+26 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<key>"_KEY_"</key>"
+27 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<readOnly>"_READONLY_"</readOnly>"
+28 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<extEntity>"_EXTENT_"</extEntity>"
+29 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<multiValued>"_MULTIVAL_"</multiValued>"
+30 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<wordProcessing>"_WORDPROC_"</wordProcessing>"
+31 ; If wp, call for wp result
+32 IF (WORDPROC="true")
Begin DoDot:4
+33 NEW VALIST,ERR
+34 DO GETWP^XPAR(.VALIST,"ALL^"_$PIECE(KEY,U,2),PAR,INST,.ERR)
+35 IF 'ERR
Begin DoDot:5
+36 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<value>"
+37 NEW ORK
SET ORK=0
+38 FOR
SET ORK=$ORDER(VALIST(ORK))
if +ORK'>0
QUIT
Begin DoDot:6
+39 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)=$$ESCAPE^XHDLXM($GET(VALIST(ORK,0)))
End DoDot:6
+40 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="</value>"
End DoDot:5
+41 NEW DFLIST,ERR
+42 DO GETWP^XPAR(.DFLIST,"PKG",PAR,INST,.ERR)
+43 IF 'ERR
Begin DoDot:5
+44 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<defaultValue>"
+45 NEW ORK
SET ORK=0
+46 FOR
SET ORK=$ORDER(VALIST(ORK))
if +ORK'>0
QUIT
Begin DoDot:6
+47 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)=$$ESCAPE^XHDLXM($GET(VALIST(ORK,0)))
End DoDot:6
+48 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="</defaultValue>"
End DoDot:5
End DoDot:4
+49 IF '$TEST
Begin DoDot:4
+50 NEW DVAL
SET DVAL=$$GET^XPAR("PKG",PAR,INST,$SELECT(VDTYPE="D":"Q",1:"E"))
+51 SET VAL=$$XFORM^XHDPTREE(VAL,VDTYPE)
+52 SET DVAL=$$XFORM^XHDPTREE(DVAL,VDTYPE)
+53 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<value>"_$$ESCAPE^XHDLXM(VAL)_"</value>"
+54 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="<defaultValue>"_$$ESCAPE^XHDLXM(DVAL)_"</defaultValue>"
End DoDot:4
+55 SET XHDCI=XHDCI+1
SET @XHDCY@("XMLDOC",XHDCI)="</parameter>"
End DoDot:3
End DoDot:2
End DoDot:1
+56 QUIT