the node attribute collections are equal: both are undefined or have the same size and value for the same keys (that can have different indices);

the child node lists are equal: both are empty or have the same length and contain equal nodes with the same indices.

Normalization affects equality. To avoid comparison errors, you are recommended to normalize nodes before comparison. Two DocumentType nodes are equal, if all of the above conditions are met and the following is true: