Archive 17/01/2023.

How to itterate all child elements in a XMLElement

SeeSoftware

i try to load a XML file and i want to itterate all of its elements to do something with them and i tried to do it like this:

for (XMLElement element = source.NextResult(); element.NotNull(); element = element.NextResult())

but it doesnt itterate anything and i have seen some XPathResult but i dont know how to use it.

Eugene

I suppose that you have no result because you have no query to iterate.
Use NextChild to iterate over elements witout query.

Modanung

Hm… shouldn’t this method actually be called NextSibling? :confused:

Eugene

I mis-recalled the name /_-
It was GetNext.