Hans,

Interesting, this looks like your API for XML programming. How do I go
about to understand this? Is there documentation, or should I just
work my way through the expansions produced by \tracingcommands=1? Or
should I not try to understand this?

Simon

On Mon, Oct 08, 2001 at 11:25:50AM +0200, Hans Hagen wrote:
> \unprotect
> 
> \def\@@XMLescape {\@@XML esc}
> 
> \def\defineXMLescape[#1]#2{\long\setvalue{\@@XMLescape:#1}{#2}}
> 
> \defineXMLescape [--]         {\gobbleuntil{-->}}
> \defineXMLescape [CDATA]      {\skipfirstverbatimlinefalse
>                                 \processtaggeddisplayverbatim{]]>}}
> \defineXMLescape [\s!default] {\gobbleuntil{>}}
> 
> \def\executeXMLescape#1%
>    {\executeifdefined{\@@XMLescape:#1}{\getvalue{\@@XMLescape:\s!default}}}
> 
> \protect
> 
> \long\def\xdoXMLelement !#1 % !-- --> or !xyz >
>    {\endgroup\executeXMLescape{#1}}
> 
> Now, given that you have a </hello/> <world/> file, and a ! handler like:
> 
> \defineXMLescape [DOCTYPE] {\handleXMLescapeDOCTYPE}
> \defineXMLescape [ENTITY]  {\handleXMLescapeENTITY}
> 
> \def\handleXMLescapeDOCTYPE#1[#2]>%
>    {#2}
> 
> \def\handleXMLescapeENTITY#1 #2 "#3"#4>%
>    {\doif{#2}{SYSTEM}{\defineXMLentity[#1]{\readfile{#3}{}{}}}}
> 
> then:
> 
> \defineXMLsingular [test] {WHOW}
> \defineXMLsingular [hello] {Hello}
> \defineXMLsingular [world] {World}
> 

-- 
Simon Pepping
email: [EMAIL PROTECTED]

Reply via email to