跳到主要内容

GetCount

Returns a number of custom XML parts in the XML manager.

Syntax

expression.GetCount();

expression - A variable that represents a ApiCustomXmlParts class.

Parameters

This method doesn't have any parameters.

Returns

number

Example

This example shows how to get the count of custom XML parts in the XML manager.

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);