ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* some XML stuff (and bugs?)
@ 2003-08-11  8:12 Martin Kolařík
  2003-08-11 12:37 ` Hans Hagen
  2003-08-11 12:41 ` Hans Hagen
  0 siblings, 2 replies; 9+ messages in thread
From: Martin Kolařík @ 2003-08-11  8:12 UTC (permalink / raw)


Hi all,

I have some problems with XML and ConTeXt, some of them are probably not
implemented in ConTeXt yet.

1. XML contains    <type>&#60;tag&#62;</type>
   I define        \defineXMLargument [type] \type
   ConTeXt outputs &#60;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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: some XML stuff (and bugs?)
  2003-08-11  8:12 some XML stuff (and bugs?) Martin Kolařík
@ 2003-08-11 12:37 ` Hans Hagen
  2003-08-11 13:40   ` Martin Kolarík
  2003-08-11 12:41 ` Hans Hagen
  1 sibling, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2003-08-11 12:37 UTC (permalink / raw)


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>&#60;tag&#62;</type>
>    I define        \defineXMLargument [type] \type
>    ConTeXt outputs &#60;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>&#60;tag&#62;</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
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: some XML stuff (and bugs?)
  2003-08-11  8:12 some XML stuff (and bugs?) Martin Kolařík
  2003-08-11 12:37 ` Hans Hagen
@ 2003-08-11 12:41 ` Hans Hagen
  2003-08-11 13:41   ` Martin Kolarík
  1 sibling, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2003-08-11 12:41 UTC (permalink / raw)


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
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: some XML stuff (and bugs?)
  2003-08-11 12:37 ` Hans Hagen
@ 2003-08-11 13:40   ` Martin Kolarík
  0 siblings, 0 replies; 9+ messages in thread
From: Martin Kolarík @ 2003-08-11 13:40 UTC (permalink / raw)


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>&#60;tag&#62;</type>
> >    I define        \defineXMLargument [type] \type
> >    ConTeXt outputs &#60;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>&#60;tag&#62;</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
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: some XML stuff (and bugs?)
  2003-08-11 12:41 ` Hans Hagen
@ 2003-08-11 13:41   ` Martin Kolarík
  2003-08-11 14:52     ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Kolarík @ 2003-08-11 13:41 UTC (permalink / raw)


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></buff
er> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: some XML stuff (and bugs?)
  2003-08-11 13:41   ` Martin Kolarík
@ 2003-08-11 14:52     ` Hans Hagen
  2003-08-11 15:27       ` Martin Kolarík
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2003-08-11 14:52 UTC (permalink / raw)


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></buff
>er> 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
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: some XML stuff (and bugs?)
  2003-08-11 14:52     ` Hans Hagen
@ 2003-08-11 15:27       ` Martin Kolarík
  2003-08-11 16:15         ` Hans Hagen
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Kolarík @ 2003-08-11 15:27 UTC (permalink / raw)




> -----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?)
>
>
> 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/>
> 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 &#60;... 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: some XML stuff (and bugs?)
  2003-08-11 15:27       ` Martin Kolarík
@ 2003-08-11 16:15         ` Hans Hagen
  2003-08-12  6:45           ` Martin Kolarík
  0 siblings, 1 reply; 9+ messages in thread
From: Hans Hagen @ 2003-08-11 16:15 UTC (permalink / raw)


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 &#60;... 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:

   <bc:buffer label="whatever">....</bc:buffer>

   <bc:buffer label="whatever"/>

although formally this equals an empty buffer, so maybe:

   <bc:getbuffer label="whatever"/>

makes more sense

does this sound ok?

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
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: some XML stuff (and bugs?)
  2003-08-11 16:15         ` Hans Hagen
@ 2003-08-12  6:45           ` Martin Kolarík
  0 siblings, 0 replies; 9+ messages in thread
From: Martin Kolarík @ 2003-08-12  6:45 UTC (permalink / raw)


>    <bc:getbuffer label="whatever"/>
>
> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-08-12  6:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-11  8:12 some XML stuff (and bugs?) Martin Kolařík
2003-08-11 12:37 ` Hans Hagen
2003-08-11 13:40   ` Martin Kolarík
2003-08-11 12:41 ` Hans Hagen
2003-08-11 13:41   ` Martin Kolarík
2003-08-11 14:52     ` Hans Hagen
2003-08-11 15:27       ` Martin Kolarík
2003-08-11 16:15         ` Hans Hagen
2003-08-12  6:45           ` Martin Kolarík

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).