unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Norman Gray <gray@nxg.name>
To: help-gnu-emacs@gnu.org
Subject: nxml-mode and parent documents
Date: Tue, 09 Jan 2024 14:58:00 +0000	[thread overview]
Message-ID: <04A597A6-2B68-421B-BC40-B847D1C06857@nxg.name> (raw)


Greetings.

[The answer to this might be: 'ask over there...-->' ! ]

I'm using the nxml-parent-document-set function in Emacs nxml-mode. It doesn't do what I expect (namely pull in internal entities such as &date; or &version; which are defined in the parent document), and I'm not sure whether I should be expecting that, or if there's a better way to achieve what I want.

I'm working with a custom (RNC) schema, in which the files containing ‘chapters’, can be processed either as part of a ‘book’ (ie, included as external entities), or standalone (where they are the complete document). The problem is that internal entities declared in the ‘book’ file are not visible in the ‘chapter’ file, so rnc-validate flags them as an error when visiting that file.

It appears that nxml-parent-document-set should resolve this, since it's documented as

> Set `nxml-parent-document' and inherit the DTD &c.

However the comment attached to the function is

> ;; FIXME: this does not work.
> ;;  the idea is that by inheriting some variables  from the parent,
> ;;  `rng-validate-mode' will validate entities declared in the parent.
> ;;  alas, the most interesting variables (`rng-compile-table' et al)
> ;;  are circular and cannot be printed even with `print-circle'.

I'm not sure whether the ‘alas’ there is telling me this doesn't in fact work (and it appears not to), or whether this is a side-remark about printing other ‘interesting variables’.

That is: is this a bug, or am I using this incorrectly?

I see that I can make the validation errors go away by extending the definition of xmltok-predefined-entity-alist (defined in xmltok.el) to include dummy values for the entities I want to refer to, but... that seems like a bit of a hack!

For reference, I see

...an emacs wiki note [1] about ‘Multi-File Documents’ which suggests asking on the (now apparently defunct) nxml-mode mailing list.
...a 14-year old query on the help-gnu-emacs list [2] which seems to have gone unanswered.

I'm using Emacs 29.1, and a version of nxml-mode.el which is dated 2022.

An alternative strategy is to include the <!DOCTYPE declarations in the ‘chapter’ files, but somehow strip those out with some sort of cunning manoeuvre during processing (unappealing). Another alternative is to include the relevant information as, eg, @DATE@, and sed-substitute those in with a different manoeuvre (unappealing for different reasons).

Best wishes,

Norman



[1] [emacs wiki note](https://www.emacswiki.org/emacs/UsingNxmlModeWithDocBook#toc6)
[2] [14-year old query on the help-gnu-emacs list](https://lists.gnu.org/archive/html/help-gnu-emacs/2009-10/msg00471.html)


-- 
Norman Gray  :  https://nxg.me.uk



                 reply	other threads:[~2024-01-09 14:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=04A597A6-2B68-421B-BC40-B847D1C06857@nxg.name \
    --to=gray@nxg.name \
    --cc=help-gnu-emacs@gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).