in reply to Re^3: XML replacenode
in thread XML replacenode

The difference between your observed and expected output appears to be down to canonicalisation. See eg:

#!/usr/bin/env perl use strict; use warnings; use XML::LibXML; my $dom = XML::LibXML->load_xml (string => <<'EOT'); <?xml version="1.0"?> <header> <id x_id="1"> <a/> <b/> <c>as</c> </id> </header> EOT print "\nNot canonical:\n\n" . $dom->toString; print "\nWith canonical:\n\n" . $dom->toStringC14N;