Itīs probably not the most effective way, but you could recursively traverse both trees and compare the value of each single node (assuming they are trees that can be read completely recursively). As soon as one differs, stop and return false.

I want to compare two xml files (tree structure).
The problem is that the one tree don't need to have the same structure like the other. The structure can differ in some cases.
The rusult of the comparison should be a information about:
which nodes of the to trees are equal and at the same position in the trees
which nodes are equal but at different positions
which nodes are just in the one file
and which nodes are just in the other file
The node should be compared by the vlalues of their attributes