I want to get the count of xml nodes present in the file with specific tags in camel exchange or camel route.
My xml tags are like this:
<parent>
<child>
<data>A</data>
</child>
<child>
<data>B</data>
</child>
<child>
<data>C</data>
<child>
<data>C1</data>
</child>
<child>
<data>C2</data>
</child>
</child>
</parent>
I want to count the <child>
tags and it should return 5 for this.
Currently, I am getting size using Exchange but it is giving output as 3.
exchange.getIn().getBody(XmlTreesType.class).getParentTree().getChildNode().size();