![](https://secure.gravatar.com/avatar/144d38ba5d13c4f10d7e8c19b2460677.jpg?s=120&d=mm&r=g)
Hi all, I have some problems with XML and ConTeXt, some of them are probably not implemented in ConTeXt yet. 1. XML contains <type><tag></type> I define \defineXMLargument [type] \type ConTeXt outputs <tag> It is interesting that inside \bTD..\eTD it is typeset correctly (<tag>). 2. Is there a way to get some piece of processed XML code into buffer (preserving blanks)? The first-approach solution of course does not work: \defineXMLenvironment [buffer] \startbuffer \stopbuffer never finds \stopbuffer. I suceed if \stopbuffer occured in XML code, but this is not the proper way :-). I also suceed when I defined \defineXMLenvironment [buffer] {\dostartbuffer [bname] [StartBuffer][/bufferdef>]} \relax and in the XML I wrote \</bufferdef>... So, how to implement somehow \defineXMLverbatim [buffer] ... which finds (and stops) reading on </buffer>? 3. if XML entity is placed before \par (e.g. in verbatim XML source, where an empty line occurs) ConTeXt fails with reading entity #2 parameter (Runaway? error). Maybe \long for \def\remapXMLentity should be used? 4. if I use <math><buffer/></math> it does not work -- <math> implementation using \XMLremapdata[mml] does not find any MML tag. Anyhow, I did not suceed with pre expansion of <buffer/> -- probably, if I am able to expand (get content of) <buffer/> (it contains MML tags) it would work. 5. some expansion stuffs, I expect it is a behaviour :-) but it would be pretty if it is possible. I did not suceed with using \getbuffer (aka all \process...buffer) in expanded environment. Simple use of \message{\getbuffer[somebuffer]} fails. If such expansion is possbile probably 4. would be solved too. Have a nice day and thank you, Martin -------- Martin Kolarik Moravske Pristroje, a.s., Masarykova 1148, Zlin 76302 tel. +420 603 498 498, fax +420 577 107 171 web: http://www.mii.cz -------- e-mail: kolarik@mii.cz e-mail: kolarik@click.cz tel. +420 603 535 593
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
At 10:12 11/08/2003 +0200, you wrote:
Hi all,
I have some problems with XML and ConTeXt, some of them are probably not implemented in ConTeXt yet.
1. XML contains <type><tag></type> I define \defineXMLargument [type] \type ConTeXt outputs <tag>
It is interesting that inside \bTD..\eTD it is typeset correctly (<tag>).
has to with the famous catcode problems, no reason to use the \type macro here: \starttext \defineXMLgrouped [type] \tt \startXMLdata test <type><tag></type> test \stopXMLdata \stoptext 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 ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
![](https://secure.gravatar.com/avatar/144d38ba5d13c4f10d7e8c19b2460677.jpg?s=120&d=mm&r=g)
ok, I use \tt and \color, thank you, Martin
-----Original Message----- From: ntg-context-admin@ntg.nl [mailto:ntg-context-admin@ntg.nl]On Behalf Of Hans Hagen Sent: Monday, August 11, 2003 2:38 PM To: ntg-context@ntg.nl Subject: Re: [NTG-context] some XML stuff (and bugs?)
At 10:12 11/08/2003 +0200, you wrote:
Hi all,
I have some problems with XML and ConTeXt, some of them are probably not implemented in ConTeXt yet.
1. XML contains <type><tag></type> I define \defineXMLargument [type] \type ConTeXt outputs <tag>
It is interesting that inside \bTD..\eTD it is typeset correctly (<tag>).
has to with the famous catcode problems, no reason to use the \type macro here:
\starttext
\defineXMLgrouped [type] \tt
\startXMLdata test <type><tag></type> test \stopXMLdata
\stoptext
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 ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
_______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
At 10:12 11/08/2003 +0200, =?iso-8859-2?Q?Martin_Kola=F8=EDk?= wrote:
4. if I use <math><buffer/></math> it does not work -- <math> implementation using \XMLremapdata[mml] does not find any MML tag. Anyhow, I did not suceed with pre expansion of <buffer/> -- probably, if I am able to expand (get content of) <buffer/> (it contains MML tags) it would work.
\starttext \defineXMLsave [buffer] \defineXMLsingular [buffer] {\XMLflush{buffer}} \startXMLdata test <buffer>here</buffer> test <buffer/> \stopXMLdata \stoptext 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 ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
![](https://secure.gravatar.com/avatar/144d38ba5d13c4f10d7e8c19b2460677.jpg?s=120&d=mm&r=g)
yes, this works:
\starttext
\defineXMLsave [buffer]
\defineXMLsingular [buffer] {\XMLflush{buffer}}
\startXMLdata test <buffer>here</buffer> test <buffer/> \stopXMLdata
but try: \startXMLdata test <buffer><mrow><mfenced><mi>a</mi><mo>+</mo><mi>b</mi></mfenced></mrow> test <math><buffer/></math>. \stopXMLdata yes, of course, this can be done including <math> into buffer (and use <buffer/> as you wrote). But this, e.g., denies including <buffer/> into some other pieces of math etc. Thank you, Martin
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
At 15:41 11/08/2003 +0200, you wrote:
yes, this works:
\starttext
\defineXMLsave [buffer]
\defineXMLsingular [buffer] {\XMLflush{buffer}}
\startXMLdata test <buffer>here</buffer> test <buffer/> \stopXMLdata
but try:
\startXMLdata test <buffer><mrow><mfenced><mi>a</mi><mo>+</mo><mi>b</mi></mfenced></mrow> test <math><buffer/></math>. \stopXMLdata
yes, of course, this can be done including <math> into buffer (and use <buffer/> as you wrote). But this, e.g., denies including <buffer/> into some other pieces of math etc.
the problem is that math does lookahead trickery and for that purpose the mathml list is converted into something internal; this also means that <buffer/> is simply ignored; think of it: what should expand and what not and when? 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 ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
![](https://secure.gravatar.com/avatar/144d38ba5d13c4f10d7e8c19b2460677.jpg?s=120&d=mm&r=g)
-----Original Message----- From: ntg-context-admin@ntg.nl [mailto:ntg-context-admin@ntg.nl]On Behalf Of Hans Hagen Sent: Monday, August 11, 2003 4:53 PM To: ntg-context@ntg.nl Subject: RE: [NTG-context] some XML stuff (and bugs?)
yes, this works:
\starttext
\defineXMLsave [buffer]
\defineXMLsingular [buffer] {\XMLflush{buffer}}
\startXMLdata test <buffer>here</buffer> test <buffer/>
At 15:41 11/08/2003 +0200, you wrote: think of it: what should expand and what not and when?
exactly said, in this case I need unwrap <buffer/> and process it in \XMLremapdata[mml]... I tried it but I did not suceed as \XMLflush executes content and, of course, there nothing is left for \XMLremapdata to remap. So, I fairly know what and how to expand, but I did not achieve this in ConTeXt. It worths for thinking :-). Currently, I have this solved -- I process my buffers first using XSLT (as I cannot decompose <... etc. in verbatim buffers into <... and then process the buffer using processXMLbuffer) to generate \startbuffer..\stopbuffer containing <>, and I assure that all buffers will contain <math> and </math> to avoid problems with expanding for \XMLremapdata. Thank you and please dismiss the topic if you want, Martin
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
At 17:27 11/08/2003 +0200, you wrote:
Currently, I have this solved -- I process my buffers first using XSLT (as I cannot decompose <... etc. in verbatim buffers into <... and then process the buffer using processXMLbuffer) to generate \startbuffer..\stopbuffer containing <>, and I assure that all buffers will contain <math> and </math> to avoid problems with expanding for \XMLremapdata.
i must have a script somewhere that prepares verbatim (simply because i
want to have more structure and so); maybe it makes sense to cook up a sort
of standard for buffers so that we can preprocess in an uniform way (some
regexp substitution is normally much faster that xslt or full blown parsing).
something:
![](https://secure.gravatar.com/avatar/144d38ba5d13c4f10d7e8c19b2460677.jpg?s=120&d=mm&r=g)
makes more sense
does this sound ok?
yes, the <buffer></buffer> construct appeared during our mail conversation :-). I myself use <bufferdef>...</bufferdef> to store data and <buffer apply="process (or type)"/> for processing or typing of stored data. Thank you, Martin
participants (3)
-
Hans Hagen
-
Martin Kolarík
-
Martin Kolařík