MXMLUTL ;mjk/alb - MXML Build Utilities ;12/11/2002 15:30
;;7.3;TOOLKIT;**67**;Apr 25, 1995
QUIT
;
XMLHDR() ; -- provides current XML standard header
QUIT "<?xml version=""1.0"" encoding=""utf-8"" ?>"
;
SYMENC(STR) ; -- replace reserved xml symbols with their encoding.
N A,I,X,Y,Z,NEWSTR,QT
S (Y,Z)="",QT=""""
I STR["&" S NEWSTR=STR D S STR=Y_Z
. F X=1:1 S Y=Y_$PIECE(NEWSTR,"&",X)_"&",Z=$PIECE(STR,"&",X+1,999) Q:Z'["&"
I STR["<" F S STR=$PIECE(STR,"<",1)_"<"_$PIECE(STR,"<",2,99) Q:STR'["<"
I STR[">" F S STR=$PIECE(STR,">",1)_">"_$PIECE(STR,">",2,99) Q:STR'[">"
I STR["'" F S STR=$PIECE(STR,"'",1)_"'"_$PIECE(STR,"'",2,99) Q:STR'["'"
I STR[QT F S STR=$PIECE(STR,QT,1)_"""_$PIECE(STR,QT,2,99) Q:STR'[QT
;
F I=1:1:$L(STR) D
. S X=$E(STR,I)
. S A=$A(X)
. IF A<31 S STR=$P(STR,X,1)_$P(STR,X,2,99)
Q STR
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMXMLUTL 876 printed Oct 16, 2024@18:11:24 Page 2
MXMLUTL ;mjk/alb - MXML Build Utilities ;12/11/2002 15:30
+1 ;;7.3;TOOLKIT;**67**;Apr 25, 1995
+2 QUIT
+3 ;
XMLHDR() ; -- provides current XML standard header
+1 QUIT "<?xml version=""1.0"" encoding=""utf-8"" ?>"
+2 ;
SYMENC(STR) ; -- replace reserved xml symbols with their encoding.
+1 NEW A,I,X,Y,Z,NEWSTR,QT
+2 SET (Y,Z)=""
SET QT=""""
+3 IF STR["&"
SET NEWSTR=STR
Begin DoDot:1
+4 FOR X=1:1
SET Y=Y_$PIECE(NEWSTR,"&",X)_"&"
SET Z=$PIECE(STR,"&",X+1,999)
if Z'["&"
QUIT
End DoDot:1
SET STR=Y_Z
+5 IF STR["<"
FOR
SET STR=$PIECE(STR,"<",1)_"<"_$PIECE(STR,"<",2,99)
if STR'["<"
QUIT
+6 IF STR[">"
FOR
SET STR=$PIECE(STR,">",1)_">"_$PIECE(STR,">",2,99)
if STR'[">"
QUIT
+7 IF STR["'"
FOR
SET STR=$PIECE(STR,"'",1)_"'"_$PIECE(STR,"'",2,99)
if STR'["'"
QUIT
+8 IF STR[QT
FOR
SET STR=$PIECE(STR,QT,1)_"""_$PIECE(STR,QT,2,99)
if STR'[QT
QUIT
+9 ;
+10 FOR I=1:1:$LENGTH(STR)
Begin DoDot:1
+11 SET X=$EXTRACT(STR,I)
+12 SET A=$ASCII(X)
+13 IF A<31
SET STR=$PIECE(STR,X,1)_$PIECE(STR,X,2,99)
End DoDot:1
+14 QUIT STR
+15 ;