app-emacs/nxml-gentoo-schemas-20111129 incorrectly marks the first element in some xml files as invalid (e.g. for any metadata.xml, <pkgmetadata> is highlighted in red). This occurs with both Emacs 23 and 24, and IIRC it used to work at least with Emacs 23 at some point. Not sure what has changed.
I've investigated a little further. The first observation is that xmllint reports the same error as rng-validate-mode in Emacs. For example, if I verify app-editors/emacs/metadata.xml: $ trang /usr/share/emacs/etc/nxml-gentoo-schemas/metadata.rnc /tmp/metadata.rng $ xmllint --relaxng /tmp/metadata.rng metadata.xml >/dev/null metadata.xml:3: element pkgmetadata: Relax-NG validity error : Did not expect element pkgmetadata there metadata.xml fails to validate It doesn't help if I generate the rng file from the dtd file directly, i.e. xmllint still reports the same error after I did this: $ trang /usr/portage/metadata/dtd/metadata.dtd /tmp/metadata.rng The second observation is that I can work around the problem if I patch /usr/share/emacs/etc/nxml-gentoo-schemas/metadata.rnc as follows: -start = catmetadata | packages +start = catmetadata | packages | pkgmetadata
Created attachment 402014 [details, diff] Patch for Makefile Trang documentation says: "Trang assumes that all elements that are defined but never referenced are allowed as document elements." This fails for pkgmetadata because it is referenced from the packages element. A workaround is to suppress generation of a start element with "-i no-generate-start" and then add one manually. See attached patch for the Makefile. I can roll a new tarball myself if you prefer. (I'd also update the distfile to be in tar.xz format then.) (In reply to Ulrich Müller from comment #0) > [...] IIRC it used to work at least with Emacs 23 at some point. Seems unlikely. I guess it has never worked for pkgmetadata.
Fixed in nxml-gentoo-schemas-20150428.