* CDATA/XML
@ 2002-03-05 19:30 Michael Wiedmann
2002-03-06 8:19 ` CDATA/XML Taco Hoekwater
0 siblings, 1 reply; 15+ messages in thread
From: Michael Wiedmann @ 2002-03-05 19:30 UTC (permalink / raw)
How does ConTeXt handle CDATA sections in XML?
The following does not work, but is legal XML:
<programlisting><![CDATA[#include <string.h>
void *memset(void *s, int c, size_t n);
3rd line
4th line
]]></programlisting>
Michael
--
mw@miwie.in-berlin.de http://www.miwie.org
mw@miwie.org
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: CDATA/XML
2002-03-05 19:30 CDATA/XML Michael Wiedmann
@ 2002-03-06 8:19 ` Taco Hoekwater
2002-03-06 9:45 ` CDATA/XML Taco Hoekwater
0 siblings, 1 reply; 15+ messages in thread
From: Taco Hoekwater @ 2002-03-06 8:19 UTC (permalink / raw)
Cc: ntg-context
On Tue, 5 Mar 2002 20:30:14 +0100
"Michael Wiedmann" <mw@miwie.in-berlin.de> wrote:
> How does ConTeXt handle CDATA sections in XML?
Incorrectly :). I'd post a fix later today.
Meanwhile, this works OK:
<programlisting><![CDATA[
#include <string.h>
void *memset(void *s, int c, size_t n);
3rd line
4th line
]]></programlisting>
Greetings, Taco
--
groeten,
Taco
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: CDATA/XML
2002-03-06 8:19 ` CDATA/XML Taco Hoekwater
@ 2002-03-06 9:45 ` Taco Hoekwater
2002-03-06 10:17 ` CDATA/XML Hans Hagen
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: Taco Hoekwater @ 2002-03-06 9:45 UTC (permalink / raw)
Cc: ntg-context
> > 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
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: CDATA/XML
2002-03-06 9:45 ` CDATA/XML Taco Hoekwater
@ 2002-03-06 10:17 ` Hans Hagen
2002-03-06 11:39 ` CDATA/XML Michael Wiedmann
2002-03-06 10:50 ` CDATA/XML Hans Hagen
2002-03-06 11:09 ` CDATA/XML Michael Wiedmann
2 siblings, 1 reply; 15+ messages in thread
From: Hans Hagen @ 2002-03-06 10:17 UTC (permalink / raw)
Cc: mw, ntg-context
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)
it can go into cont-new.tex after \unprotect and is then available at run time
actually, CDATA is handled in xtag-pre but the problem is using a space as
delimiter (will have a look)
is <![ always CDATA ?
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | pragma@wxs.nl
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
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: CDATA/XML
2002-03-06 9:45 ` CDATA/XML Taco Hoekwater
2002-03-06 10:17 ` CDATA/XML Hans Hagen
@ 2002-03-06 10:50 ` Hans Hagen
2002-03-06 19:45 ` CDATA/XML Michael Wiedmann
2002-03-06 11:09 ` CDATA/XML Michael Wiedmann
2 siblings, 1 reply; 15+ messages in thread
From: Hans Hagen @ 2002-03-06 10:50 UTC (permalink / raw)
Cc: mw, ntg-context
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 | pragma@wxs.nl
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
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: CDATA/XML
2002-03-06 9:45 ` CDATA/XML Taco Hoekwater
2002-03-06 10:17 ` CDATA/XML Hans Hagen
2002-03-06 10:50 ` CDATA/XML Hans Hagen
@ 2002-03-06 11:09 ` Michael Wiedmann
2 siblings, 0 replies; 15+ messages in thread
From: Michael Wiedmann @ 2002-03-06 11:09 UTC (permalink / raw)
Cc: ntg-context
Taco Hoekwater wrote:
> Here is a fix for Context that makes sure it behaves ok wrt.
> CDATA sections. Should be included somewhere on top of the document
[...]
Are you sure this works for possibly included "<!DOCTYPE" declarations?
Michael
--
office: michael.wiedmann@detewe.de
private: mw@miwie.in-berlin.de http://www.miwie.org/
mw@miwie.org
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: CDATA/XML
2002-03-06 10:17 ` CDATA/XML Hans Hagen
@ 2002-03-06 11:39 ` Michael Wiedmann
2002-03-06 12:42 ` CDATA/XML Hans Hagen
2002-03-06 13:54 ` CDATA/XML Taco Hoekwater
0 siblings, 2 replies; 15+ messages in thread
From: Michael Wiedmann @ 2002-03-06 11:39 UTC (permalink / raw)
Cc: Taco Hoekwater, ntg-context
Hans Hagen wrote:
[...]
> actually, CDATA is handled in xtag-pre but the problem is using a space as
> delimiter (will have a look)
>
> is <![ always CDATA ?
No,
there are so-called conditional sections which start with "<![" too
(e.g. "<![IGNORE[", "<![INCLUDE[").
The spec says:
2.7 CDATA Sections
[Definition: CDATA sections may occur anywhere character data may occur;
they are used to escape blocks of text containing characters which would
otherwise be recognized as markup. CDATA sections begin with the string
"<![CDATA[" and end with the string "]]>":]
Michael
--
office: michael.wiedmann@detewe.de
private: mw@miwie.in-berlin.de http://www.miwie.org/
mw@miwie.org
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: CDATA/XML
2002-03-06 11:39 ` CDATA/XML Michael Wiedmann
@ 2002-03-06 12:42 ` Hans Hagen
2002-03-06 13:56 ` CDATA/XML Taco Hoekwater
2002-03-06 13:54 ` CDATA/XML Taco Hoekwater
1 sibling, 1 reply; 15+ messages in thread
From: Hans Hagen @ 2002-03-06 12:42 UTC (permalink / raw)
Cc: Taco Hoekwater, ntg-context
At 12:39 PM 3/6/2002 +0100, Michael Wiedmann wrote:
>Hans Hagen wrote:
>[...]
> > actually, CDATA is handled in xtag-pre but the problem is using a space as
> > delimiter (will have a look)
> >
> > is <![ always CDATA ?
>
>No,
>there are so-called conditional sections which start with "<![" too
>(e.g. "<![IGNORE[", "<![INCLUDE[").
ok, so these can be handled by the installable version
\defineXMLescape [IGNORE] {\gobbleuntil{]]>}}
and so on
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | pragma@wxs.nl
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
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: CDATA/XML
2002-03-06 11:39 ` CDATA/XML Michael Wiedmann
2002-03-06 12:42 ` CDATA/XML Hans Hagen
@ 2002-03-06 13:54 ` Taco Hoekwater
1 sibling, 0 replies; 15+ messages in thread
From: Taco Hoekwater @ 2002-03-06 13:54 UTC (permalink / raw)
Cc: pragma, ntg-context
On Wed, 06 Mar 2002 12:39:07 +0100
"Michael Wiedmann" <michael.wiedmann@detewe.de> wrote:
> Hans Hagen wrote:
> [...]
> > actually, CDATA is handled in xtag-pre but the problem is using a space as
> > delimiter (will have a look)
> >
> > is <![ always CDATA ?
In an XML instance, yes.
> No,
> there are so-called conditional sections which start with "<![" too
> (e.g. "<![IGNORE[", "<![INCLUDE[").
These are only allowed in the external subset (in a DTD). Because ConTeXt doesn't
parse DTDs, it doesn't really matter. Which is a good thing, because this is also
legal wrt. conditional sections:
<!ENTITY % draft 'INCLUDE' >
<!ENTITY % final 'IGNORE' >
<![%draft;[
<!ELEMENT editedbook (comments*, title, body, supplements?)>
<![ %final; [
<!ELEMENT book (title, body, supplements?)>
]]>]]>
and parsing all that is well beyond the scope of the current parser. ;)
--
groeten,
Taco
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: CDATA/XML
2002-03-06 12:42 ` CDATA/XML Hans Hagen
@ 2002-03-06 13:56 ` Taco Hoekwater
0 siblings, 0 replies; 15+ messages in thread
From: Taco Hoekwater @ 2002-03-06 13:56 UTC (permalink / raw)
Cc: michael.wiedmann, ntg-context
On Wed, 06 Mar 2002 13:42:13 +0100 "Hans Hagen" <pragma@wxs.nl> wrote:
> ok, so these can be handled by the installable version
>
> \defineXMLescape [IGNORE] {\gobbleuntil{]]>}}
Not true but not relevant either (see my other post)
--
groeten,
Taco
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: CDATA/XML
2002-03-06 10:50 ` CDATA/XML Hans Hagen
@ 2002-03-06 19:45 ` Michael Wiedmann
2002-03-06 21:48 ` CDATA/XML Hans Hagen
0 siblings, 1 reply; 15+ messages in thread
From: Michael Wiedmann @ 2002-03-06 19:45 UTC (permalink / raw)
Cc: Taco Hoekwater, ntg-context
* Hans Hagen <pragma@wxs.nl> [020306 11:50]:
[...]
> In the beta the patch is:
>
> in xtag-ini: grab #1 from ]...]
>
> \long\def\xparseXMLescape !#1#2%
[...]
In my current newly installed beta version from 2002-03-04 I can't find
this exactly as shown, so I understand your posting, that the patch will
go into the next version? This is OK for me.
Thanks
Michael
--
mw@miwie.in-berlin.de http://www.miwie.org
mw@miwie.org
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: CDATA/XML
2002-03-06 19:45 ` CDATA/XML Michael Wiedmann
@ 2002-03-06 21:48 ` Hans Hagen
2002-03-13 12:47 ` CDATA/XML Michael Wiedmann
0 siblings, 1 reply; 15+ messages in thread
From: Hans Hagen @ 2002-03-06 21:48 UTC (permalink / raw)
Cc: Taco Hoekwater, ntg-context
At 08:45 PM 3/6/2002 +0100, Michael Wiedmann wrote:
>* Hans Hagen <pragma@wxs.nl> [020306 11:50]:
>[...]
> > In the beta the patch is:
> >
> > in xtag-ini: grab #1 from ]...]
> >
> > \long\def\xparseXMLescape !#1#2%
>[...]
>
>In my current newly installed beta version from 2002-03-04 I can't find
>this exactly as shown, so I understand your posting, that the patch will
>go into the next version? This is OK for me.
should be xtag-ini and xtag-pre, in your version too; never mind, the next
version has it in there anyway
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | pragma@wxs.nl
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
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: CDATA/XML
2002-03-06 21:48 ` CDATA/XML Hans Hagen
@ 2002-03-13 12:47 ` Michael Wiedmann
2002-03-13 14:32 ` CDATA/XML Taco Hoekwater
2002-03-13 14:34 ` CDATA/XML Hans Hagen
0 siblings, 2 replies; 15+ messages in thread
From: Michael Wiedmann @ 2002-03-13 12:47 UTC (permalink / raw)
Cc: ntg-context
Hans Hagen wrote:
> should be xtag-ini and xtag-pre, in your version too; never mind, the next
> version has it in there anyway
Using the latest Beta (2002-03-12) CDATA still does not work :-(
[ I see the changes you suggested a few days ago in xtag-pre.tex and
xtag-ini.tex ]
Michael
--
office: michael.wiedmann@detewe.de
private: mw@miwie.in-berlin.de http://www.miwie.org/
mw@miwie.org
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: CDATA/XML
2002-03-13 12:47 ` CDATA/XML Michael Wiedmann
@ 2002-03-13 14:32 ` Taco Hoekwater
2002-03-13 14:34 ` CDATA/XML Hans Hagen
1 sibling, 0 replies; 15+ messages in thread
From: Taco Hoekwater @ 2002-03-13 14:32 UTC (permalink / raw)
Cc: pragma, ntg-context
On Wed, 13 Mar 2002 13:47:45 +0100
"Michael Wiedmann" <michael.wiedmann@detewe.de> wrote:
> Hans Hagen wrote:
>
> > should be xtag-ini and xtag-pre, in your version too; never mind, the next
> > version has it in there anyway
>
> Using the latest Beta (2002-03-12) CDATA still does not work :-(
>
> [ I see the changes you suggested a few days ago in xtag-pre.tex and
> xtag-ini.tex ]
Works ok in processed XML files, just not in XMLdata/XMLcode.
For Hans: I am guessing there is no ^M available due to catcode changes ?
--
groeten,
Taco
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: CDATA/XML
2002-03-13 12:47 ` CDATA/XML Michael Wiedmann
2002-03-13 14:32 ` CDATA/XML Taco Hoekwater
@ 2002-03-13 14:34 ` Hans Hagen
1 sibling, 0 replies; 15+ messages in thread
From: Hans Hagen @ 2002-03-13 14:34 UTC (permalink / raw)
Cc: ntg-context
At 01:47 PM 3/13/2002 +0100, you wrote:
>Hans Hagen wrote:
>
> > should be xtag-ini and xtag-pre, in your version too; never mind, the next
> > version has it in there anyway
>
>Using the latest Beta (2002-03-12) CDATA still does not work :-(
>
>[ I see the changes you suggested a few days ago in xtag-pre.tex and
>xtag-ini.tex ]
can you send me your (small) sample file?
hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | pragma@wxs.nl
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
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2002-03-13 14:34 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-05 19:30 CDATA/XML Michael Wiedmann
2002-03-06 8:19 ` CDATA/XML Taco Hoekwater
2002-03-06 9:45 ` CDATA/XML Taco Hoekwater
2002-03-06 10:17 ` CDATA/XML Hans Hagen
2002-03-06 11:39 ` CDATA/XML Michael Wiedmann
2002-03-06 12:42 ` CDATA/XML Hans Hagen
2002-03-06 13:56 ` CDATA/XML Taco Hoekwater
2002-03-06 13:54 ` CDATA/XML Taco Hoekwater
2002-03-06 10:50 ` CDATA/XML Hans Hagen
2002-03-06 19:45 ` CDATA/XML Michael Wiedmann
2002-03-06 21:48 ` CDATA/XML Hans Hagen
2002-03-13 12:47 ` CDATA/XML Michael Wiedmann
2002-03-13 14:32 ` CDATA/XML Taco Hoekwater
2002-03-13 14:34 ` CDATA/XML Hans Hagen
2002-03-06 11:09 ` CDATA/XML Michael Wiedmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).