At 10:33 PM 10/8/2001 +0200, Simon Pepping wrote:
>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?
in a couple of days i will release the new xtag modules, most of the
interfac eis described in eXaMpLe.pdf but not yet this 'written in 5
minutes' api.
>Simon
>
>On Mon, Oct 08, 2001 at 11:25:50AM +0200, Hans Hagen wrote:
> > \unprotect
> >
> > \def\@@XMLescape {\@@XML esc}
everything xml has a namespace, this is the prefix, not for users
> > \def\defineXMLescape[#1]#2{\long\setvalue{\@@XMLescape:#1}{#2}}
> >
> > \defineXMLescape [--] {\gobbleuntil{-->}}
> > \defineXMLescape [CDATA] {\skipfirstverbatimlinefalse
> > \processtaggeddisplayverbatim{]]>}}
> > \defineXMLescape [\s!default] {\gobbleuntil{>}}
these are default def's, using a couple of context system macros, described
in syst-*.tex (it may be worth printing the documentation for syst-gen.tex
and alike: texexec --pdf --modu syst-tex.tex
> > \def\executeXMLescape#1%
> > {\executeifdefined{\@@XMLescape:#1}{\getvalue{\@@XMLescape:\s!default}}}
again, something not for the user, this hooks into the element handler
(which captures ? ! and the rest)
> > \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}{}{}}}}
this is the kind of stuff that users can write to extend the parser, btu i
will probably add reasonable thinsg to the kernel
what happens here is that (since <! can end up in anything) you need to
grab eveything till the end sequence, for instance being --> or ]> ior
whatever. Here a little knowledge of tex and xml helps -)
> > then:
> >
> > \defineXMLsingular [test] {WHOW}
> > \defineXMLsingular [hello] {Hello}
> > \defineXMLsingular [world] {World}
this is described in example.pdf
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | [EMAIL PROTECTED]
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------