XmlNode.Normalize XmlNode.Normalize XmlNode.Normalize XmlNode.Normalize Method


使這個 XmlNode 之下子樹狀結構的整個深度中所有 XmlText 節點成為「一般」形式,其中只用標記 (Markup) (亦即標記 (Tag)、註解、處理指示、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.