Closed rbarbey closed 8 years ago
That's an iterator over a lazily computed set of nodes. See the implementation of Iter.Next. If you want to know the full length, you'll need to iterate over it and pay the price. I wouldn't like to hide that complexity over a Length() method, and we definitely cannot have it as a field.
I'm using xmlpath for writing tests which verify that a generated XML file contains all required information. Unfortunately, there is currently no way to get the number of matched elements contained in an
Iter
. I would like to be able to write a test like this (using testify in this case):