From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/100662 Path: news.gmane.org!.POSTED!not-for-mail From: Hans van der Meer Newsgroups: gmane.comp.tex.context Subject: Re: problem with character entities in XML processing Date: Thu, 19 Apr 2018 15:55:56 +0200 Message-ID: <1C515A04-D08A-480A-9484-379F1D8AEEAB@ziggo.nl> References: <545FDE7A-C848-462E-8CCA-03587986475C@ziggo.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Content-Type: multipart/mixed; boundary="===============5835193508839995979==" X-Trace: blaine.gmane.org 1524146061 11757 195.159.176.226 (19 Apr 2018 13:54:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 19 Apr 2018 13:54:21 +0000 (UTC) To: NTG ConTeXt Original-X-From: ntg-context-bounces@ntg.nl Thu Apr 19 15:54:17 2018 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f9A0n-0002pv-Gk for gctc-ntg-context-518@m.gmane.org; Thu, 19 Apr 2018 15:54:09 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id BFA7562620F; Thu, 19 Apr 2018 15:56:09 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9Ouen0xbGibh; Thu, 19 Apr 2018 15:56:09 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 0E9E06261F6; Thu, 19 Apr 2018 15:56:09 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 5A5686261F6 for ; Thu, 19 Apr 2018 15:56:08 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BOC7pT9WUrcs for ; Thu, 19 Apr 2018 15:56:07 +0200 (CEST) Original-Received: from smtpq4.mnd.mail.iss.as9143.net (smtpq4.mnd.mail.iss.as9143.net [212.54.34.167]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 892956261F3 for ; Thu, 19 Apr 2018 15:55:57 +0200 (CEST) Original-Received: from [212.54.34.115] (helo=smtp7.mnd.mail.iss.as9143.net) by smtpq4.mnd.mail.iss.as9143.net with esmtp (Exim 4.86_2) (envelope-from ) id 1f9A2X-0005NK-8S for ntg-context@ntg.nl; Thu, 19 Apr 2018 15:55:57 +0200 Original-Received: from 546a86c8.cm-12-3c.dynamic.ziggo.nl ([84.106.134.200] helo=[192.168.178.10]) by smtp7.mnd.mail.iss.as9143.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.86_2) (envelope-from ) id 1f9A2X-0001Yz-2E for ntg-context@ntg.nl; Thu, 19 Apr 2018 15:55:57 +0200 In-Reply-To: X-Mailer: Apple Mail (2.3445.6.18) X-SourceIP: 84.106.134.200 X-Authenticated-Sender: havdmeer@ziggo.nl (via SMTP) X-Ziggo-spambar: / X-Ziggo-spamscore: 0.0 X-Ziggo-spamreport: CMAE Analysis: v=2.3 cv=MPpOZvRl c=1 sm=1 tr=0 a=wCstmS+ZHA3zSJXjQC+ubA==:17 a=9+rZDBEiDlHhcck0kWbJtElFXBc=:19 a=Kd1tUaAdevIA:10 a=MiNTnEJAAAAA:8 a=YEMqx4UAAAAA:8 a=ACQCx6kCAAAA:8 a=xtERp6CFAAAA:8 a=a3nu-2BBAAAA:8 a=Uows8UApAAAA:8 a=ln9Y2cLpSRF24checToA:9 a=QEXdDO2ut3YA:10 a=KUVUyp9iF3ef2q-EXQYA:9 a=WI3VF-1fmerdAncI:21 a=_W_S_7VecoQA:10 a=LmrbSfiT3hecnSZifb5M:22 a=V0662LiR8DSfwiDagK97:22 a=Sab0UneHBzlWrQDlOuxD:22 a=ekCXXmE-vB8RPiJ3MEZb:22 a=oX0v64vK4IwbpfTCMRm2:22 none X-Ziggo-Spam-Status: No X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:100662 Archived-At: --===============5835193508839995979== Content-Type: multipart/alternative; boundary="Apple-Mail=_91668879-E00F-405D-99AA-56A6D1E36067" --Apple-Mail=_91668879-E00F-405D-99AA-56A6D1E36067 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Indeed. I should have known better. Temporary attack of brain weakness, = I suppose. For those who want to see for themselves, the minimal example = below will do. dr. Hans van der Meer % test character entity. \startxmlsetups demo:entity \xmlsetsetup{#1}{root}{demo:entity:*} \stopxmlsetups \xmlregisterdocumentsetup{demo}{demo:entity} \startxmlsetups demo:entity:root \blank Start test:\crlf flushing: \xmlflush{#1}\crlf End test\blank \stopxmlsetups \startbuffer[demo] amp =3D & and #38 =3D & \stopbuffer \starttext \currentdate-\currenttime\quad\ConTeXt-version=3D\contextversion\blank {\bf Testing use of character entities}\blank These should produce the same result: \type{&} and \type{&} and = indeed they do.\blank \xmlprocessbuffer{demo}{demo}{}\blank \stoptext > On 19 Apr 2018, at 14:44, Hans Hagen wrote: >=20 > On 4/19/2018 10:53 AM, Hans van der Meer wrote: >> The following use of character entities & aborts in ConTeXt. = That is of course because the # is seen as a parameter. Changing this to = &\#xxx; or &\letterhash xxx; typesets & as is, but that is not the = intention, because an ampersand should appear. So, how do I proceed = here? >> Minimal example: >> % test character entity failure. >> \startxmlsetups demo:entity >> \xmlsetsetup{#1}{root}{demo:entity:*} >> \stopxmlsetups >> \xmlregisterdocumentsetup{demo}{demo:entity} >> \startxmlsetups demo:entity:root >> \blank Start test:\crlf >> root: =3D "&"\crlf >> root: =3D "&\letterhash 038;=E2=80=9D\crlf % &\#038; = produces the same >> End test\blank >> \stopxmlsetups >=20 > you are tex mode there so & =3D=3D & >=20 >=20 >> \startbuffer[demo] >> >> \stopbuffer >> \starttext >> \currentdate-\currenttime\quad\ConTeXt-version=3D\contextversion\blank >> {\bf Testing use of character entities}\blank >> These should produce the same result: \type{&} and = \type{&}\blank >> \xmlprocessbuffer{demo}{demo}{}\blank >> \stoptext >> dr. Hans van der Meer >> = __________________________________________________________________________= _________ >> 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://context.aanhet.net >> archive : https://bitbucket.org/phg/context-mirror/commits/ >> wiki : http://contextgarden.net >> = __________________________________________________________________________= _________ >=20 >=20 > --=20 >=20 > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl = | www.pragma-pod.nl = > ----------------------------------------------------------------- --Apple-Mail=_91668879-E00F-405D-99AA-56A6D1E36067 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Indeed. I should have known better. Temporary attack of brain = weakness, I suppose. For those who want to see for themselves, the = minimal example below will do.

dr. Hans van der Meer

% = test character entity.
\startxmlsetups demo:entity
= \xmlsetsetup{#1}{root}{demo:entity:*}
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{demo:entity}
\startxmlsetups = demo:entity:root
= \blank Start test:\crlf
flushing: = \xmlflush{#1}\crlf
= End test\blank
\stopxmlsetups
\startbuffer[demo]
<?xml version=3D"1.0" = encoding=3D"UTF-8"?>
<root>amp =3D &amp; and #38 =3D = &#38;</root>
\stopbuffer
\starttext
\currentdate-\currenttime\quad\ConTeXt-version=3D\contextversio= n\blank
{\bf= Testing use of character entities}\blank
These should produce the = same result: \type{&amp;} and \type{&#038;} and indeed they = do.\blank
\xmlprocessbuffer{demo}{demo}{}\blank
\stoptext



On 19 Apr 2018, at 14:44, Hans Hagen <j.hagen@xs4all.nl> = wrote:

On 4/19/2018 10:53 AM, Hans van = der Meer wrote:
The following use of character = entities &#038; aborts in ConTeXt. That is of course because the # = is seen as a parameter. Changing this to &\#xxx; or = &\letterhash xxx; typesets &#038; as is, but that is not = the intention, because an ampersand should appear. So, how do I proceed = here?
Minimal example:
% test character = entity failure.
\startxmlsetups demo:entity
\xmlsetsetup{#1}{root}{demo:entity:*}
\stopxmlsetups
\xmlregisterdocumentsetup{demo}{demo:entity}
\startxmlsetups demo:entity:root
\blank Start = test:\crlf
root: <amp> =3D "&amp;"\crlf
root: <number> =3D "&\letterhash 038;=E2=80=9D\crlf = % &\#038; produces the same
End test\blank
\stopxmlsetups

you are tex mode there so & = =3D=3D &


\startbuffer[demo]
<root></root>
\stopbuffer
\starttext
\currentdate-\currenttime\quad\ConTeXt-version=3D\contextversio= n\blank
{\bf Testing use of character entities}\blank
These should produce the same result: \type{&amp;} and = \type{&#038;}\blank
\xmlprocessbuffer{demo}{demo}{}\blank
\stoptext
dr. Hans van der Meer
_______________________________________________________________= ____________________
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://context.aanhet.net
archive  : = https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
_______________________________________________________________= ____________________


-- 
---------------------------------------------------------------= --
          &nb= sp;            = ;            &= nbsp;     Hans Hagen | PRAGMA ADE
          &nb= sp;  Ridderstraat 27 | 8061 GH Hasselt | The = Netherlands
      tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
---------------------------------------------------------------= --

= --Apple-Mail=_91668879-E00F-405D-99AA-56A6D1E36067-- --===============5835193508839995979== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f --===============5835193508839995979==--