Count of nodes in XML


Do we have any built in service in webMethods to count number of nodes in given XML.

I assume there is nothing out-of-the-box. But you can write custom java service and make use of DOM parser (also explore other xml parsers like SAX, STAX)

Have a look at the below link:

1 Like

I agree we should have to write custom java service for this.


Try converting the xml string to node and node to document. If your xml string contains multiple nodes (say 3) after you convert to IData (document) it will be under a document list (I suppose, I need to test to make sure it is). Get the size of the document list using sizeOfList BIS.

Give a try and check. Any questions?

Ignore the above suggestion. Mapping to sizeOfList is not straight forward. Go ahead with Java service.