At 10:45 AM 3/6/2002 +0100, Taco Hoekwater wrote:

> > > How does ConTeXt handle CDATA sections in XML?
> >
> > Incorrectly :). I'd post a fix later today.
> >
> > Meanwhile, this works OK:
>
>Oops, it didn't. :(
>
>Here is a fix for Context that makes sure it behaves ok wrt.
>CDATA sections. Should be included somewhere on top of the document
>or in cont-usr.tex (until it makes it into the distribution)
>
>
>% start of patch
>\let\doxparseXMLescape\xparseXMLescape
>\def\xparseXMLescape!#1%
>    {\if[#1%
>        \expandafter\expandafter\expandafter\doCDATAsection
>     \else \if-#1%
>        \expandafter\expandafter\expandafter\doCOMMENT
>     \else
>        \expandafter\expandafter\expandafter\doparseXMLescape
>     \fi\fi !#1}
>
>\def\doCDATAsection![#1[%
>   {\skipfirstverbatimlinefalse
>    \processtaggeddisplayverbatim{]]>}}
>
>\def\doCOMMENT {\gobbleuntil{-->}}
>% end of patch

In the beta the patch is:

in xtag-ini: grab #1 from ]...]

\long\def\xparseXMLescape !#1#2%
   {\if#1-%
      \if#2-%
        \expandafter\expandafter\expandafter\xxparseXMLescape
      \else
        \expandafter\expandafter\expandafter\xyparseXMLescape
      \fi
    \else
      \if#1[%
        \expandafter\expandafter\expandafter\xzparseXMLescape
      \else
        \expandafter\expandafter\expandafter\xyparseXMLescape
      \fi
    \fi#1#2}

\long\def\xzparseXMLescape[#1[{\parseXMLescape{#1}}

in xtag-pre: {CDATA]} => CDATA

\defineXMLescape [CDATA]
   {\skipfirstverbatimlinefalse
    \processtaggeddisplayverbatim{]]>}}

So, this way we keep the installable parser in place

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
-------------------------------------------------------------------------
                                   fall-back web server: 
www.pragma-ade.nl
-------------------------------------------------------------------------

Reply via email to