[NTG-context] processing xml in mkiv

Thomas A. Schmitz thomas.schmitz at uni-bonn.de
Sun Mar 16 13:00:51 CET 2008

On Mar 16, 2008, at 12:04 PM, Wolfgang Schuster wrote:

> On Sun, 16 Mar 2008 11:29:49 +0100
> "Thomas A. Schmitz" <thomas.schmitz at uni-bonn.de> wrote:
>> Hi all,
>> xml processing is about the last part of my ConTeXt stuff where I
>> haven't been able to switch to mkiv; I just can't get my head around
>> it... 2 questions:
>> 1. When I try to process a xml-file with my old (mkii) environments,
>> the output looks OK, but I always get a first page with the xml
>> version declaration
>> <?xml version="1.0" encoding="utf-8"?>
>> Is this a bug or a feature? Is there anything I can do to prevent it?
> Can you post a example, I never saw such a effect in my test files.

Hi Wolfgang,

OK, here is a minimal example:

file test.xml:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE test [
<!ELEMENT document   (section)>
<!ELEMENT section    (#PCDATA)>

   <section title="First">
     <p>This is <quotation>an</quotation> xml file.</p>

file testenvironment.tex





When I process with mkii, I get the expected output. Processing with

texexec --lua --env=testenvironment test.xml

gives me the first line (here it's not an entire page) I described!

>> 2. I'm really lost with the new xml mechanism. My first problem: In a
>> message from September last year, Hans explained that the command to
>> process xml files is:
>>> The regular definitions still work but processing a file is done
>>> differently:
>>>    \xmlprocess{id}{filename}{optional initialization setup}
>> I used to have environments with which to typeset a bunch of files.
>> How can  this be ported to the new mechanism, which appears to expect
>> a filename?
> \xmlprocess{main}{filename.xml}{} works for me.

I tried to translate this into the "new" mechanism and thought it  
should read like so:

\startxmlsetups xml:mysetups


\startxmlsetups xml:p

\startxmlsetups xml:quotation

\startxmlsetups xml:section


But then, I only get "invalid xml file" in the output.

>> Sorry if these are very basic problems, but I'm probably a bit obtuse
>> here.
> You don't have to use new xml mechanism form MkIV, the old code could
> be used without problems. The advantage of the new code is direct
> access to elements in the tree (you could use xml files as database)
> and the option to read from zip files.
> Wolfgang

OK, I'll keep that in mind. Thanks for your help, Wolfgang!


More information about the ntg-context mailing list