From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/5789 Path: main.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: Some XML typesetting questions Date: Mon, 08 Oct 2001 11:25:50 +0200 Sender: owner-ntg-context@let.uu.nl Message-ID: <5.1.0.14.1.20011008112132.031f8528@server-1> References: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Trace: main.gmane.org 1035396357 4577 80.91.224.250 (23 Oct 2002 18:05:57 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 18:05:57 +0000 (UTC) Cc: Jaroslav Snajdr , ntg-context@ntg.nl Original-To: Berend de Boer In-Reply-To: <878zemy5d7.fsf@dellius.nederware.nl> Xref: main.gmane.org gmane.comp.tex.context:5789 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:5789 At 09:10 AM 10/8/2001 +0200, Berend de Boer wrote: >Jaroslav Snajdr writes: > > > Hello, > > > > I've started playing with XML support in Context and have a couple of > problems: > > > > 1. My XML document is divided into several files. The DOCTYPE > declaration looks like this: > > > > > > > > > ]> > > > > .. > > &ch1; > > &ch2; > > .. > > > > > > How can I process this document in Context? I can define the > > entities &chx;, but that means to define the mapping to file at two > > places. > > >I think Hans should give you a call back for ENTITY. There you can do >your own parsing and define the entities based on the particular >entity definition. > >AFAIK this is not yet possible. You're right! Say that you have: \unprotect \def\@@XMLescape {\@@XML esc} \def\defineXMLescape[#1]#2{\long\setvalue{\@@XMLescape:#1}{#2}} \defineXMLescape [--] {\gobbleuntil{-->}} \defineXMLescape [CDATA] {\skipfirstverbatimlinefalse \processtaggeddisplayverbatim{]]>}} \defineXMLescape [\s!default] {\gobbleuntil{>}} \def\executeXMLescape#1% {\executeifdefined{\@@XMLescape:#1}{\getvalue{\@@XMLescape:\s!default}}} \protect \long\def\xdoXMLelement !#1 % !-- --> or !xyz > {\endgroup\executeXMLescape{#1}} Now, given that you have a file, and a ! handler like: \defineXMLescape [DOCTYPE] {\handleXMLescapeDOCTYPE} \defineXMLescape [ENTITY] {\handleXMLescapeENTITY} \def\handleXMLescapeDOCTYPE#1[#2]>% {#2} \def\handleXMLescapeENTITY#1 #2 "#3"#4>% {\doif{#2}{SYSTEM}{\defineXMLentity[#1]{\readfile{#3}{}{}}}} then: \defineXMLsingular [test] {WHOW} \defineXMLsingular [hello] {Hello} \defineXMLsingular [world] {World} \startXMLdata ]> test test &wellwell; \stopXMLdata will do what you want. But i suppose that the DOCTYPE syntax is richer that this example and i praise myself lucky that i don;t have a copy of the specs here -) 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 -------------------------------------------------------------------------