XmlNode.Normalize 方法


将此 XmlNode 下子树完全深度中的所有 XmlText 节点都转换成“正常”形式,在这种形式中只有标记(即标记、注释、处理指令、CDATA 节和实体引用)分隔 XmlText 节点,也就是说,没有相邻的 XmlText 节点。Puts all XmlText nodes in the full depth of the sub-tree underneath this XmlNode into a "normal" form where only markup (that is, tags, comments, processing instructions, CDATA sections, and entity references) separates XmlText nodes, that is, there are no adjacent XmlText nodes.

 virtual void Normalize();
public virtual void Normalize ();
abstract member Normalize : unit -> unit
override this.Normalize : unit -> unit
Public Overridable Sub Normalize ()


此方法可用于确保文档的 DOM 视图与已保存并重新加载的视图相同,并且在使用依赖于特定文档树结构的操作(如 XPointer 查找)时非常有用。This method can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer lookups) that depend on a particular document tree structure are to be used.