ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans van der Meer <havdmeer@ziggo.nl>
To: NTG ConTeXt <ntg-context@ntg.nl>
Subject: Re: problem with character entities in XML processing
Date: Thu, 19 Apr 2018 15:55:56 +0200	[thread overview]
Message-ID: <1C515A04-D08A-480A-9484-379F1D8AEEAB@ziggo.nl> (raw)
In-Reply-To: <bd67389b-f37b-68c7-ba08-72792542a235@xs4all.nl>


[-- Attachment #1.1: Type: text/plain, Size: 3029 bytes --]

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="1.0" encoding="UTF-8"?>
<root>amp = &amp; and #38 = &#38;</root>
\stopbuffer
\starttext
\currentdate-\currenttime\quad\ConTeXt-version=\contextversion\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> = "&amp;"\crlf
>> root: <number> = "&\letterhash 038;”\crlf % &\#038; produces the same
>> End test\blank
>> \stopxmlsetups
> 
> you are tex mode there so & == &
> 
> 
>> \startbuffer[demo]
>> <root></root>
>> \stopbuffer
>> \starttext
>> \currentdate-\currenttime\quad\ConTeXt-version=\contextversion\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
>> ___________________________________________________________________________________
> 
> 
> -- 
> 
> -----------------------------------------------------------------
>                                          Hans Hagen | PRAGMA ADE
>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>       tel: 038 477 53 69 | www.pragma-ade.nl <http://www.pragma-ade.nl/> | www.pragma-pod.nl <http://www.pragma-pod.nl/>
> -----------------------------------------------------------------


[-- Attachment #1.2: Type: text/html, Size: 16194 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

      parent reply	other threads:[~2018-04-19 13:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-19  8:53 Hans van der Meer
     [not found] ` <bd67389b-f37b-68c7-ba08-72792542a235@xs4all.nl>
2018-04-19 13:55   ` Hans van der Meer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1C515A04-D08A-480A-9484-379F1D8AEEAB@ziggo.nl \
    --to=havdmeer@ziggo.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).