How to find and count the repeated values of XML

Asked By 30 points N/A Posted on -
qa-featured

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.

SHARE
Best Answer by Sharon D Mickelson
Answered By 0 points N/A #198380

How to find and count the repeated values of XML

qa-featured

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.

Best Answer
Best Answer
Answered By 10 points N/A #134243

How to find and count the repeated values of XML

qa-featured

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!

Related Questions