HomeClusterLabs Projects

Refactor: libcrmcommon: pcmk__xml2text() takes const xmlNode * argument

Description

Refactor: libcrmcommon: pcmk__xml2text() takes const xmlNode * argument

It would be nice to use libxml's dump function for its intended purpose
when we don't need to filter the XML (as in
dump_xml_formatted_with_text()). However, there are a couple of issues.

  • Our dumping implementation escapes attribute values, while libxml's xmlNodeDumpOutput() does not. This means attribute value formatting is inconsistent depending on whether we're including text nodes (which are unrelated to attribute values). This isn't strictly a bug, but it's certainly counter-intuitive that the output from dump_xml_formatted_with_text() differs from that of dump_xml_formatted() in any way other than inclusion of text nodes.
  • xmlNodeDumpOutput() prevents pcmk__xml2text() from taking a const argument.

It's also easier to read if everything uses the same implementation,
though this is secondary (cleaning up comments would have gone a long
way toward readability).

The only caller that passes pcmkxml_fmt_full is
dump_xml_formatted_with_text(), so we can simply use pcmk
xml_fmt_text
there.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>

Details

Provenance
nrwahl2Authored on Aug 24 2023, 9:57 PM
Parents
rPec24672b7da7: Refactor: libcrmcommon: Don't set pcmk__xml_fmt_full in log_data_element
Branches
Unknown
Tags
Unknown