ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* ConTeXt, XML and verbatim
@ 2003-09-03 14:09 Pawel Jackowski na WP
  2003-09-03 19:49 ` Simon Pepping
  0 siblings, 1 reply; 10+ messages in thread
From: Pawel Jackowski na WP @ 2003-09-03 14:09 UTC (permalink / raw)


I.

I'm working on some documentation writen in XML. This documentation contain
many nested XML files.
To process XML I use simple ConTeXt construction

\processXMLfilegrouped{file.xml}

(or)

\starttext
\processXMLfilegrouped{file.xml}
\stoptext

In XML source nested files are involved by <nested/> tag.
To process nested XML files I have defined something like this:

\defineXMLcommand [nested]
   {\processXMLfile{\XMLpar{nested}{src}{}}}

It works good.

I want to treat each 'newline-char' as a space (in the whole document).
For that purpose I use:

\catcode`^^M=10

The problem is that it DOESN'T work for nested XML files. How can I set
someting like this
for the whole XML structure, not only for file processed just 'under'
ConTeXt? It works only for the file processed
directly by the command \processXMLfile{...}

II.

Meybe someone knowns how to 'translate' verbatim environments for XML code?
I mean how to define environment which I can use in this way

<verbatim>
....
</verbatim>

to get literal content of such XML tag?


Thanks, Paweł Jackowski

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

* Re: ConTeXt, XML and verbatim
  2003-09-03 14:09 ConTeXt, XML and verbatim Pawel Jackowski na WP
@ 2003-09-03 19:49 ` Simon Pepping
  2003-09-03 20:18   ` Matt Gushee
  2003-09-04  6:49   ` ConTeXt, XML and verbatim -- thanks Pawel Jackowski na Onet
  0 siblings, 2 replies; 10+ messages in thread
From: Simon Pepping @ 2003-09-03 19:49 UTC (permalink / raw)


On Wed, Sep 03, 2003 at 04:09:32PM +0200, Pawel Jackowski na WP wrote:
> II.
> 
> Meybe someone knowns how to 'translate' verbatim environments for XML code?
> I mean how to define environment which I can use in this way
> 
> <verbatim>
> ....
> </verbatim>
> 
> to get literal content of such XML tag?

There are no verbatim environments in XML, and you cannot get literal
content. Instead, you can have tags, like your verbatim above, that
request line-oriented layout. programlisting is such a tag in Docbook.

This is how docbook in context does it:

\def\XMLDBstartlineorientedlayout
   {\bgroup
    \frenchspacing \obeyspaces \obeytabs \obeylines
    \parindent=0pt%
    \setupwhitespace[none]
    \def\obeyedline{\par\def\obeyedline{\strut\par}}%
    \def\obeyedspace{\strut\space}%
    \blank[medium]}
\def\XMLDBstoplineorientedlayout{\blank[medium]\egroup}

\defineXMLenvironment[programlisting]
   {\XMLDBstartlineorientedlayout 
    \tt\XMLsimpleentitiestrue}%
   {\XMLDBstoplineorientedlayout}

Regards, Simon

-- 
Simon Pepping
email: spepping@scaprea.hobby.nl
home page: scaprea.hobby.nl

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

* Re: ConTeXt, XML and verbatim
  2003-09-03 19:49 ` Simon Pepping
@ 2003-09-03 20:18   ` Matt Gushee
  2003-09-04 19:09     ` Pawel Jackowski na Onet
                       ` (2 more replies)
  2003-09-04  6:49   ` ConTeXt, XML and verbatim -- thanks Pawel Jackowski na Onet
  1 sibling, 3 replies; 10+ messages in thread
From: Matt Gushee @ 2003-09-03 20:18 UTC (permalink / raw)


On Wed, Sep 03, 2003 at 09:49:40PM +0200, Simon Pepping wrote:
> > 
> > Meybe someone knowns how to 'translate' verbatim environments for XML code?
> > I mean how to define environment which I can use in this way
> > 
> > <verbatim>
> > ....
> > </verbatim>
> > 
> > to get literal content of such XML tag?
> 
> There are no verbatim environments in XML, and you cannot get literal
> content. Instead, you can have tags, like your verbatim above, that
> request line-oriented layout. programlisting is such a tag in Docbook.

That's correct with respect to elements--since XML deliberately avoids
defining semantics for any element.  But you seem to be overlooking
CDATA sections, which are more-or-less verbatim environments. The XML
spec doesn't directly address the question of formatting in CDATA
sections, but all characters are supposed to be output literally, and
AFAIK that includes white space--hence all formatting should be
preserved.

But I don't know if ConTeXt can handle CDATA sections. Can it?

-- 
Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through
mgushee@havenrock.com           its fields;
http://www.havenrock.com/   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                                
                            --Lao Tzu (Peter Merel, trans.)

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

* ConTeXt, XML and verbatim -- thanks
  2003-09-03 19:49 ` Simon Pepping
  2003-09-03 20:18   ` Matt Gushee
@ 2003-09-04  6:49   ` Pawel Jackowski na Onet
  2003-09-04 18:59     ` Hans Hagen
  1 sibling, 1 reply; 10+ messages in thread
From: Pawel Jackowski na Onet @ 2003-09-04  6:49 UTC (permalink / raw)


Hello!

> There are no verbatim environments in XML, and you cannot get literal
> content. Instead, you can have tags, like your verbatim above, that
> request line-oriented layout. programlisting is such a tag in Docbook.
> 
> This is how docbook in context does it:
> 
> \def\XMLDBstartlineorientedlayout
>    {\bgroup
>     \frenchspacing \obeyspaces \obeytabs \obeylines
>     \parindent=0pt%
>     \setupwhitespace[none]
>     \def\obeyedline{\par\def\obeyedline{\strut\par}}%
>     \def\obeyedspace{\strut\space}%
>     \blank[medium]}
> \def\XMLDBstoplineorientedlayout{\blank[medium]\egroup}
> 
> \defineXMLenvironment[programlisting]
>    {\XMLDBstartlineorientedlayout 
>     \tt\XMLsimpleentitiestrue}%
>    {\XMLDBstoplineorientedlayout}

Thanks Simon! Such line-oriented environment is also a solution.

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

* Re: ConTeXt, XML and verbatim -- thanks
  2003-09-04  6:49   ` ConTeXt, XML and verbatim -- thanks Pawel Jackowski na Onet
@ 2003-09-04 18:59     ` Hans Hagen
  2003-09-05  8:34       ` ConTeXt, XML and verbatim Pawel Jackowski na Onet
  0 siblings, 1 reply; 10+ messages in thread
From: Hans Hagen @ 2003-09-04 18:59 UTC (permalink / raw)


At 08:49 04/09/2003 +0200, you wrote:
>Hello!
>
> > There are no verbatim environments in XML, and you cannot get literal
> > content. Instead, you can have tags, like your verbatim above, that
> > request line-oriented layout. programlisting is such a tag in Docbook.
> >
> > This is how docbook in context does it:
> >
> > \def\XMLDBstartlineorientedlayout
> >    {\bgroup
> >     \frenchspacing \obeyspaces \obeytabs \obeylines
> >     \parindent=0pt%
> >     \setupwhitespace[none]
> >     \def\obeyedline{\par\def\obeyedline{\strut\par}}%
> >     \def\obeyedspace{\strut\space}%
> >     \blank[medium]}
> > \def\XMLDBstoplineorientedlayout{\blank[medium]\egroup}
> >
> > \defineXMLenvironment[programlisting]
> >    {\XMLDBstartlineorientedlayout
> >     \tt\XMLsimpleentitiestrue}%
> >    {\XMLDBstoplineorientedlayout}
>
>Thanks Simon! Such line-oriented environment is also a solution.


Pawel,

you can learns a few tricks from x-contml and other x-* modules

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] 10+ messages in thread

* Re: ConTeXt, XML and verbatim
  2003-09-03 20:18   ` Matt Gushee
@ 2003-09-04 19:09     ` Pawel Jackowski na Onet
  2003-09-04 19:28       ` Hans Hagen
  2003-09-04 19:31     ` Hans Hagen
  2003-09-06 15:49     ` Simon Pepping
  2 siblings, 1 reply; 10+ messages in thread
From: Pawel Jackowski na Onet @ 2003-09-04 19:09 UTC (permalink / raw)


Hi!

> On Wed, Sep 03, 2003 at 09:49:40PM +0200, Simon Pepping wrote:
> > >
> > > Meybe someone knowns how to 'translate' verbatim environments for XML
code?
> > > I mean how to define environment which I can use in this way [......]

> > There are no verbatim environments in XML, and you cannot get literal
> > content. Instead, you can have tags, like your verbatim above, that
> > request line-oriented layout. programlisting is such a tag in Docbook.

> That's correct with respect to elements--since XML deliberately avoids
> defining semantics for any element.  But you seem to be overlooking
> CDATA sections, which are more-or-less verbatim environments. The XML
> spec doesn't directly address the question of formatting in CDATA
> sections, but all characters are supposed to be output literally, and
> AFAIK that includes white space--hence all formatting should be
> preserved.
>
> But I don't know if ConTeXt can handle CDATA sections. Can it?

Good question! As far as I'm concerned (but I'm not concerned far...)
ConTeXt can handle some 'metadata'
like <!ENTITY...>. But I don't know exaclty which levels of XML syntax is
handled with ConTeXt core.
I hope Hans will provide some workshops :)


Regards, Pawel

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

* Re: ConTeXt, XML and verbatim
  2003-09-04 19:09     ` Pawel Jackowski na Onet
@ 2003-09-04 19:28       ` Hans Hagen
  0 siblings, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2003-09-04 19:28 UTC (permalink / raw)


At 21:09 04/09/2003 +0200, you wrote:

>Good question! As far as I'm concerned (but I'm not concerned far...)
>ConTeXt can handle some 'metadata'
>like <!ENTITY...>. But I don't know exaclty which levels of XML syntax is
>handled with ConTeXt core.
>I hope Hans will provide some workshops :)

well, arrange one at bachotek -)

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] 10+ messages in thread

* Re: ConTeXt, XML and verbatim
  2003-09-03 20:18   ` Matt Gushee
  2003-09-04 19:09     ` Pawel Jackowski na Onet
@ 2003-09-04 19:31     ` Hans Hagen
  2003-09-06 15:49     ` Simon Pepping
  2 siblings, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2003-09-04 19:31 UTC (permalink / raw)


At 14:18 03/09/2003 -0600, you wrote:

>But I don't know if ConTeXt can handle CDATA sections. Can it?


kind of, but i like more structured verbatim (see x-contml.tex) which can 
be hoocked ito the verbatim environment

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] 10+ messages in thread

* Re: ConTeXt, XML and verbatim
  2003-09-04 18:59     ` Hans Hagen
@ 2003-09-05  8:34       ` Pawel Jackowski na Onet
  0 siblings, 0 replies; 10+ messages in thread
From: Pawel Jackowski na Onet @ 2003-09-05  8:34 UTC (permalink / raw)


> Pawel,
>
> you can learns a few tricks from x-contml and other x-* modules

Yes, indeed! x-* modules are mines of tricks. I've got what i want by saying
something like:

\defineXMLenvironment[verbatim]
 {\bgroup\obeyspaces\defineXMLargument[verbline]{\endgraf\type}}
 {\egroup}

Thanks, Pawel

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

* Re: ConTeXt, XML and verbatim
  2003-09-03 20:18   ` Matt Gushee
  2003-09-04 19:09     ` Pawel Jackowski na Onet
  2003-09-04 19:31     ` Hans Hagen
@ 2003-09-06 15:49     ` Simon Pepping
  2 siblings, 0 replies; 10+ messages in thread
From: Simon Pepping @ 2003-09-06 15:49 UTC (permalink / raw)


On Wed, Sep 03, 2003 at 02:18:27PM -0600, Matt Gushee wrote:
> On Wed, Sep 03, 2003 at 09:49:40PM +0200, Simon Pepping wrote:
> > > 
> > There are no verbatim environments in XML, and you cannot get literal
> > content. Instead, you can have tags, like your verbatim above, that
> > request line-oriented layout. programlisting is such a tag in Docbook.
> 
> That's correct with respect to elements--since XML deliberately avoids
> defining semantics for any element.  But you seem to be overlooking
> CDATA sections, which are more-or-less verbatim environments. The XML
> spec doesn't directly address the question of formatting in CDATA
> sections, but all characters are supposed to be output literally, and
> AFAIK that includes white space--hence all formatting should be
> preserved.

I specifically mean CDATA sections. CDATA sections do no more than
disabling markup. They do not say that this is verbatim, they do not
say that this should get a special layout, they do not say that white
space should be handled differently.

<p>This <![CDATA[is CDATA]]> and it does not mean a
thing. <![CDATA[Ben & Jerry]]> sell icecream. Ben &amp; Jerry do not
like to see their name in monotype font.

Regards, Simon

-- 
Simon Pepping
email: spepping@scaprea.hobby.nl
home page: scaprea.hobby.nl

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

end of thread, other threads:[~2003-09-06 15:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-03 14:09 ConTeXt, XML and verbatim Pawel Jackowski na WP
2003-09-03 19:49 ` Simon Pepping
2003-09-03 20:18   ` Matt Gushee
2003-09-04 19:09     ` Pawel Jackowski na Onet
2003-09-04 19:28       ` Hans Hagen
2003-09-04 19:31     ` Hans Hagen
2003-09-06 15:49     ` Simon Pepping
2003-09-04  6:49   ` ConTeXt, XML and verbatim -- thanks Pawel Jackowski na Onet
2003-09-04 18:59     ` Hans Hagen
2003-09-05  8:34       ` ConTeXt, XML and verbatim Pawel Jackowski na Onet

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