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
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
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.)
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
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 -------------------------------------------------------------------------
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 -------------------------------------------------------------------------
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 & 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
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.
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 -------------------------------------------------------------------------
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
participants (5)
-
Hans Hagen
-
Matt Gushee
-
Pawel Jackowski na Onet
-
Pawel Jackowski na WP
-
Simon Pepping