CharacterData.length as Number
The length of the character data (codepoints).
cts.doc("example.xml").root.firstChild.length
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.