GetCount
返回 XML 管理器中自定义 XML 部件的数量。
语法
expression.GetCount();
expression - 表示 ApiCustomXmlParts 类的变量。
参数
此方法没有任何参数。
返回值
number
示例
此示例演示如何获取 XML 管理器中自定义 XML 部件的数量。
let doc = Api.GetDocument();
let xmlManager = doc.GetCustomXmlParts();
xmlManager.Add("<products><item><name>Laptop</name><price>999</price></item></products>");
xmlManager.Add("<user><name>John Doe</name><email>john@example.com</email></user>");
let count = xmlManager.GetCount();
let infoParagraph = Api.CreateParagraph();
infoParagraph.AddText("There are " + count + " custom XML parts in the document.");
doc.Push(infoParagraph);