I have some XML files for which I want to get the count of nodes. However, I don't want to go and start coding. I have checked some XML tools like Notepadd++ XML Plugin, Cygwin xmllint, XML Notepad 2007, but none of them provide this feature.

Basically, I need kind of a summery count of nodes. Is there any software that can do that? Googling seems to only provide solution that require programming.

6 Answers 6


I found this online tool that you may find useful: http://www.freeformatter.com/xpath-tester.html. Examples are included on the same page.

  • 2
    xpath == coding :)
    – akira
    Jan 29, 2014 at 6:52
  • Bro. There might be tools that let you do that, but I don't know about. Why don't you make a plugin for Notepad++ if you really want one. Hmm... I might try one as soon as I get time. Will post here if I get to it. Jan 29, 2014 at 6:54
  • you missed my point: counting elements in something arbitrary like xml is only possible for something like a programming language because it must support such fancy counting ideas such as "well, count all subnodes called 'foo' underneath the nodes 'bar' and 'shoo', but only as long as their not adjacent to each other". OP will have a hard time to find something that does the job if he stick to his non-programming requirement. xpath is the right answer imho.
    – akira
    Jan 29, 2014 at 7:12
  • xpath coding is pretty much the thing I need and it works with xmlint and notepad++ xml plugin. The link contains the basic examples of xpath which was enough for what I had in mind. Thanx
    – th1rdey3
    Jan 29, 2014 at 7:24
  • This tool has 2 megabytes restriction. Mar 24, 2017 at 21:04

To elaborate on the Notepad++ answer, you can also use the Count button in the search dialogue box. My XML file has thousands of nodes and it gave me the count of a particalur <node>value</node> in a couple of seconds. The find all option was less useful because it shows by line so my node got hidden away.

The final alternative I found was the Mark option which will mark the string and (optionally) set a bookmark. The bookmark doesn't solve the problem when a node and children are on a single line but you can at least jump to the next line with the marked text by pressing F2.

Added: This works ok when you have lots of the same values but if you're trying to discover the different values you need a way to exclude. I ended up searching with a Regular Expression to filter out the values I found as I went along so <node>(?!Value1|Value2|Value3).*</node> The group excludes the values that you have found

I just keep coming back to Notepad++ for these jobs, it's a wonderful program

  • This got me a quick and dirty solution. If you're worried that a similarly-named node might be at a different level in the file, first use XML Tools to 'pretty print' it to get indented child element, and search for the element prefaced by the proper number of tabs. Mar 28, 2017 at 16:11

In some simple cases, the easiest way is to open XML file in a web browser window (e.g. Chrome displays XML tree), then count items using 'find on page' function (usually CTRL+F or CMD+F) and paste your node identity string like this <o id= for nodes like that <o id="18" url="...">...</o>. The browser will count found occurrences for you. Essentially, any text editor will do that job also.


Not sure how complex your count must be, but I had similar issue and just used notepad++ search option.

I guess it's tedious if you've got a lot of nodes to count and a lot of files, but it's good as a one off.


Use command line

find /C "<NodeName or Pattern>" <filename>.xml

should give you the count of the nodes you are looking for.


I had similiar issue, needed to count the number of nodes in an xml, non-programatically. The approach I took was to convert the xml to a csv, and then do the math in excel.

Online tool to convert XML to CSV - https://www.convertcsv.com/xml-to-csv.htm

In Excel, use formula COUNTA

  • The idea that you can "convert" XML to CSV is just as flawed as the idea that you can replace Chinese words with English words to get English. It will look like English, but it's rubbish. If it works for you, great; but in the general case, it will often not.
    – tripleee
    Apr 23, 2020 at 8:44
  • As a humorous and/or despairing illustration, here's the result of running Google Translate to Chinese and then back to English on the first sentence above: "The idea of "converting" XML to CSV is as flawed as the idea of replacing English words with English words to get English."
    – tripleee
    Apr 23, 2020 at 8:45

Not the answer you're looking for? Browse other questions tagged .