Delete
从自定义 XML 管理器中删除 XML。
语法
expression.Delete();
expression - 表示 ApiCustomXmlPart 类的变量。
参数
此方法没有任何参数。
返回值
boolean
示例
从文档中移除嵌入的 XML 数据块。
// How do I delete one of the XML data blocks stored inside a document?
// Clean up stale or unwanted structured data by removing it from the document entirely.
let doc = Api.GetDocument();
let xmlManager = doc.GetCustomXmlParts();
let xml1 = xmlManager.Add("<user xmlns='http://example'>John</user>");
let xml2 = xmlManager.Add("<customer xmlns='http://example'>Alex</customer>");
xml1.Delete();
let count = xmlManager.GetCount();
let xmlParts = xmlManager.GetAll();
let infoParagraph = Api.CreateParagraph();
xmlParts.forEach(part => {
infoParagraph.AddText("XML part: " + part.GetXml());
});
doc.Push(infoParagraph);