This paper introduces xcls++, an improved algorithm for clustering XML documents, overcoming limitations of its predecessor xcls+. The proposed method optimizes similarity calculation by addressing issues related to duplicate nodes and structural relationships, ultimately enhancing clustering efficiency. The results demonstrate that xcls++ outperforms xcls+ in terms of optimality and accuracy for XML document clustering.