source: WorldVistAEHR/trunk/r/XML_PARSER-MXML/MXMLUTL.m@ 954

Last change on this file since 954 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 853 bytes
Line 
1MXMLUTL ;mjk/alb - MXML Build Utilities ;12/11/2002 15:30
2 ;;7.3;TOOLKIT;**67**;Apr 25, 1995
3 QUIT
4 ;
5XMLHDR() ; -- provides current XML standard header
6 QUIT "<?xml version=""1.0"" encoding=""utf-8"" ?>"
7 ;
8SYMENC(STR) ; -- replace reserved xml symbols with their encoding.
9 N A,I,X,Y,Z,NEWSTR,QT
10 S (Y,Z)="",QT=""""
11 I STR["&" S NEWSTR=STR D S STR=Y_Z
12 . F X=1:1 S Y=Y_$PIECE(NEWSTR,"&",X)_"&amp;",Z=$PIECE(STR,"&",X+1,999) Q:Z'["&"
13 I STR["<" F S STR=$PIECE(STR,"<",1)_"&lt;"_$PIECE(STR,"<",2,99) Q:STR'["<"
14 I STR[">" F S STR=$PIECE(STR,">",1)_"&gt;"_$PIECE(STR,">",2,99) Q:STR'[">"
15 I STR["'" F S STR=$PIECE(STR,"'",1)_"&apos;"_$PIECE(STR,"'",2,99) Q:STR'["'"
16 I STR[QT F S STR=$PIECE(STR,QT,1)_"&quot;"_$PIECE(STR,QT,2,99) Q:STR'[QT
17 ;
18 F I=1:1:$L(STR) D
19 . S X=$E(STR,I)
20 . S A=$A(X)
21 . IF A<31 S STR=$P(STR,X,1)_$P(STR,X,2,99)
22 Q STR
23 ;
Note: See TracBrowser for help on using the repository browser.