Hello list, I'm working with XML in ConTeXt. Now I want parse a XML-File with the following structure, which is an export from a database. <?xml version="1.0" encoding="UTF-8"?> <personal> <person> <Name></Name> <Vorname></Vorname> <Titel></Titel> <Bezeichnung></Bezeichnung> <Mail></Mail> <Raum></Raum> <Telefon></Telefon> </person> I'm using this ConTeXt script. \setuppapersize [A4,landscape][A4,landscape] \usemodule [simplefonts] \setmainfont[rubscalatz] \setsansfont[rubflama] \startxmlsetups xml:personen:base % associate setups with elements \xmlsetsetup{personen}{personal|person}{xml:personen:*} \stopxmlsetups \xmlregisterdocumentsetup{personen}{xml:personen:base} \startxmlsetups xml:personen:personal \title{Personalverzeichnis} \placelist[chapter] \page \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:personen:personal:person % associate setups with elements \bTABLE \bTR \bTD {/Name} \eTD \eTR \eTABLE \stopxmlsetups \starttext \xmlprocessfile{personen}{personen.xml}{} \stoptext The generated PDF-file only consists of one page with the chapter "Personalverzeichnis". Can anybody tell me, where the mistake is? Daniel
Hi Daniel, On 11/02/2010 08:50 PM, Daniel Grycman wrote:
Hello list,
I'm working with XML in ConTeXt. Now I want parse a XML-File with the following structure, which is an export from a database.
<?xml version="1.0" encoding="UTF-8"?> <personal> <person> <Name></Name> <Vorname></Vorname> <Titel></Titel> <Bezeichnung></Bezeichnung> <Mail></Mail> <Raum></Raum> <Telefon></Telefon> </person>
</personal> First, there is nothing to flush in the elements. You want to flush content of the elements (now empty), or their names?
\setuppapersize [A4,landscape][A4,landscape] \usemodule [simplefonts] \setmainfont[rubscalatz] \setsansfont[rubflama] \startxmlsetups xml:personen:base % associate setups with elements \xmlsetsetup{personen}{personal|person}{xml:personen:*} \stopxmlsetups \xmlregisterdocumentsetup{personen}{xml:personen:base}
\startxmlsetups xml:personen:personal \title{Personalverzeichnis} \placelist[chapter] \page \xmlflush{#1} \stopxmlsetups
\startxmlsetups xml:personen:personal:person
\startxmlsetups xml:personen:person this is above registered xmlsetup
\bTABLE \bTR \bTD {/Name} \eTD \eTR
\bTR \bTD \xmltext{#1}{/Name} \eTD \eTR you either flush "named" element with \xmltext or all elements with \xmlflush
\eTABLE \stopxmlsetups
\starttext \xmlprocessfile{personen}{personen.xml}{} \stoptext
The generated PDF-file only consists of one page with the chapter "Personalverzeichnis". Can anybody tell me, where the mistake is?
Daniel
Jano
Hi Jano and list,
it works so far. But how can I set up a tablehead for the whole table?
Daniel
Am 02.11.10 21:22 schrieb "Jano Kula" unter
Hi Daniel,
On 11/02/2010 08:50 PM, Daniel Grycman wrote:
Hello list,
I'm working with XML in ConTeXt. Now I want parse a XML-File with the following structure, which is an export from a database.
<?xml version="1.0" encoding="UTF-8"?> <personal> <person> <Name></Name> <Vorname></Vorname> <Titel></Titel> <Bezeichnung></Bezeichnung> <Mail></Mail> <Raum></Raum> <Telefon></Telefon> </person>
</personal>
First, there is nothing to flush in the elements. You want to flush content of the elements (now empty), or their names?
\setuppapersize [A4,landscape][A4,landscape] \usemodule [simplefonts] \setmainfont[rubscalatz] \setsansfont[rubflama] \startxmlsetups xml:personen:base % associate setups with elements \xmlsetsetup{personen}{personal|person}{xml:personen:*} \stopxmlsetups \xmlregisterdocumentsetup{personen}{xml:personen:base}
\startxmlsetups xml:personen:personal \title{Personalverzeichnis} \placelist[chapter] \page \xmlflush{#1} \stopxmlsetups
\startxmlsetups xml:personen:personal:person
\startxmlsetups xml:personen:person
this is above registered xmlsetup
\bTABLE \bTR \bTD {/Name} \eTD \eTR
\bTR \bTD \xmltext{#1}{/Name} \eTD \eTR
you either flush "named" element with \xmltext or all elements with \xmlflush
\eTABLE \stopxmlsetups
\starttext \xmlprocessfile{personen}{personen.xml}{} \stoptext
The generated PDF-file only consists of one page with the chapter "Personalverzeichnis". Can anybody tell me, where the mistake is?
Daniel
Jano
__________________________________________________________________________ _________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net __________________________________________________________________________ _________
Am 02.11.2010 um 22:17 schrieb Daniel Grycman:
Hi Jano and list,
it works so far. But how can I set up a tablehead for the whole table?
http://wiki.contextgarden.net/TABLE#Multipage_TABLEs Wolfgang
Hi Wolfgang and list,
I already used this multipage table. But the result showed a header for
every entry of the xml-source. Is there an option which I missed?
\startxmlsetups xml:personen:person % associate setups with elements
\bTABLE[split=yes,width=11em]
\setupTABLE[row][*][width=\textwidth]
\bTABLEhead
\bTR \bTH Name \eTH \bTH Vorname \eTH \bTH Email-Adresse \eTH \bTH Raum
\eTH \bTH Telefon \eTH \eTR
\eTABLEhead
\bTABLEbody
\bTR \bTD \xmltext{#1}{/Titel} \xmltext{#1}{/Name} \eTD \bTD
\xmltext{#1}{/Vorname} \eTD \bTD \xmltext{#1}{/Mail} \eTD \bTD
\xmltext{#1}{/Raum} \eTD \bTD \xmltext{#1}{/Telefon} \eTD \eTR
\eTABLEbody
\eTABLE
\stopxmlsetups
Daniel
Am 02.11.10 22:38 schrieb "Wolfgang Schuster" unter
Am 02.11.2010 um 22:17 schrieb Daniel Grycman:
Hi Jano and list,
it works so far. But how can I set up a tablehead for the whole table?
http://wiki.contextgarden.net/TABLE#Multipage_TABLEs
Wolfgang
__________________________________________________________________________ _________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net __________________________________________________________________________ _________
A side remark: Try to indent your context code so that it is easier to read (just like you indent xml). For example (adding | so that the email client does not reformt it) | \startxmlsetups xml:personen:person % associate setups with elements | \bTABLE[split=yes,width=11em] | \setupTABLE[row][*][width=\textwidth] | \bTABLEhead | \bTR | \bTH Name \eTH | \bTH Vorname \eTH | \bTH Email-Adresse \eTH | \bTH Raum \eTH | \bTH Telefon \eTH | \eTR | \eTABLEhead | \bTABLEbody | \bTR | \bTD \xmltext{#1}{/Titel} \xmltext{#1}{/Name} \eTD | \bTD \xmltext{#1}{/Vorname} \eTD | \bTD \xmltext{#1}{/Mail} \eTD | \bTD \xmltext{#1}{/Raum} \eTD | \bTD \xmltext{#1}{/Telefon} \eTD | \eTR | \eTABLEbody | \eTABLE | \stopxmlsetups This makes it much easier to see what is going on. Aditya
On 11/02/2010 10:59 PM, Daniel Grycman wrote:
Hi Wolfgang and list,
I already used this multipage table. But the result showed a header for every entry of the xml-source. Is there an option which I missed?
No option, you want to set up the header only once, hence you need to typeset it in the parent element of multiple <person> elements, here <personal>. \startxmlsetups xml:personen:personal \title{Personalverzeichnis} \placelist[chapter] \page % open table \bTABLE[split=yes,width=11em] \setupTABLE[row][*][width=\textwidth] \bTABLEhead \bTR \bTH Name \eTH \bTH Vorname \eTH \bTH Email-Adresse \eTH \bTH Raum \eTH \bTH Telefon \eTH \eTR \eTABLEhead \bTABLEbody % and now deeper to multiple persons (rows) \xmlflush{#1} % close table \eTABLEbody \eTABLE \stopxmlsetups \startxmlsetups xml:personen:person % here every person generates one row \bTR \bTD \xmltext{#1}{/Titel} \xmltext{#1}{/Name} \eTD \bTD \xmltext{#1}{/Vorname} \eTD \bTD \xmltext{#1}{/Mail} \eTD \bTD \xmltext{#1}{/Raum} \eTD \bTD \xmltext{#1}{/Telefon} \eTD \eTR \stopxmlsetups Jano
\startxmlsetups xml:personen:person % associate setups with elements \bTABLE[split=yes,width=11em] \setupTABLE[row][*][width=\textwidth] \bTABLEhead \bTR \bTH Name \eTH \bTH Vorname \eTH \bTH Email-Adresse \eTH \bTH Raum \eTH \bTH Telefon \eTH \eTR \eTABLEhead \bTABLEbody \bTR \bTD \xmltext{#1}{/Titel} \xmltext{#1}{/Name} \eTD \bTD \xmltext{#1}{/Vorname} \eTD \bTD \xmltext{#1}{/Mail} \eTD \bTD \xmltext{#1}{/Raum} \eTD \bTD \xmltext{#1}{/Telefon} \eTD \eTR \eTABLEbody \eTABLE \stopxmlsetups
Daniel
Am 02.11.10 22:38 schrieb "Wolfgang Schuster" unter
: Am 02.11.2010 um 22:17 schrieb Daniel Grycman:
Hi Jano and list,
it works so far. But how can I set up a tablehead for the whole table?
http://wiki.contextgarden.net/TABLE#Multipage_TABLEs
Wolfgang
__________________________________________________________________________ _________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net __________________________________________________________________________ _________
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
participants (4)
-
Aditya Mahajan
-
Daniel Grycman
-
Jano Kula
-
Wolfgang Schuster