xml.dom.minidom count how many tags of a specific type exist

4.5k Views Asked by At

I'm trying to work with the wolfram alpha api and I want to get a count back of how many <plaintext></plaintext> elements there are so I can run through them with dom.getElementsByTagName

1

There are 1 best solutions below

0
On BEST ANSWER

Just use,

dom.getElementsByTagName("plaintext").length

getElementsByTagName() returns a NodeList which has a property length.

Documentation