How to find and count the repeated values of XML
Hello,
I figured an XML and there is an element repeated for two times.
I want to find and count the repeated element.
But I don't get it.
Please help me with an example code.
Hello,
I figured an XML and there is an element repeated for two times.
I want to find and count the repeated element.
But I don't get it.
Please help me with an example code.
Hello! You can visit https://www.w3schools.com/ to get a full tutorial.
I think they can provide you the proper solution.
It's better to visit this link https://www.w3schools.com/xml/default.asp.
But there are other sites and forums that are relatively engaged in this type of case and has answers.
Search in Google to get more info.
Best of luck.
I can give you an algorithm to find this programmatically. Read the elements in the XML one after the other and insert them into a HashMap with element name as key and 1 as the value.
While you insert the element name, make a check to see if it is already available. If its available increment the value by 1.
This way you could get the elements which are repeated.
Hope this helps!