OK, here is a minimal example:
file test.xml:
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE test [ <!ELEMENT document (section)> <!ELEMENT section (#PCDATA)> ]>
<document> <section title="First"> <p>This is <quotation>an</quotation> xml file.</p> </section> </document>
file testenvironment.tex
\usemodule[xtag-ent]
\defineXMLenvironment[document] {\starttext} {\stoptext}
\defineXMLenvironment[section] {\section{\XMLpar{section}{title}{}}} {}
\defineXMLenvironment[quotation] {\quotation\bgroup} {\egroup}
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!
This seems like a bug to me. This did only happen with the content in the first line because I inserted a empty first line at the begin of the line the xml header disappeared from the pdf, could be related to a wrong catcode for the "<" at the beginning of the line.
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 \xmlsetsetup{\xmldocument}{text:p|section|quotation}{xml:*} \stopxmlsetups
\xmlregistersetup{xml:mysetups}
\startxmlsetups xml:p \xmlflush{#1}\endgraf \stopxmlsetups
\startxmlsetups xml:quotation \quotation{\xmlflush{#1}} \stopxmlsetups
\startxmlsetups xml:section \section{\xmlatt{#1}{section}{title}} \stopxmlsetups
\startxmlsetups xml:section \section{\xmlatt{#1}{section}{title}} \xmlflush{#1} \stopxmlsetups
\starttext \xmlprocess{main}{test.xml}{} \stoptext
But then, I only get "invalid xml file" in the output.
Remove the DOCDATA definition from your xml file, seems the parser has problems with "<>" pairs inside of the DOCDATA definition. The following line give me a pdf file <!DOCTYPE document [ <!ELEMENT section (p) ]> but the next one <!DOCTYPE document [ <!ELEMENT section (p)> ]> give only "invalid xml file". Wolfgang