builtins.toXML generates self-closing tags where it shouldn't

#399
Opened by qyliss at 2024-04-09T10·01+00

builtins.toXML {}

cppnix:

<?xml version='1.0' encoding='utf-8'?>
<expr>
  <attrs>
  </attrs>
</expr>

tvix:

<?xml version='1.0' encoding='utf-8'?>
<expr>
  <attrs />
</expr>

  1. qyliss updated the body of this issue at 2024-04-09T10·04+00
  2. With cppnix, some elements are self-closing, but not all — int is self-closing, but attrs never is.

    xml-rs doesn't support varying whether empty elements are self-closing except with a global setting, so either xml-rs has to be changed to implement this, or XML generation has to be implemented in a different way.

    This came up for me in the context of grub-config.xml in NixOS.

    qyliss at 2024-04-09T14·23+00

  3. fixed by cl/11697, which includes this example as a testcase (tvix/eval/src/tests/tvix_tests/eval-okay-toxml-empty.nix).

    flokli at 2024-05-22T10·58+00

  4. flokli closed this issue at 2024-05-22T10·58+00