I saw this question :
But it doesnt have the info which im looking for:
my question :
I know that XPathDocument Loads the complete xml into the memory :
My question is from the stage where the xml is already loaded :
which one of them will faster find the desired elements :
XPathDocument with XPathNavigator
or
xmlReader with If’s conditions
If by
you mean that it’s already going to be loaded into an XPathDocument or XmlDocument, then the performance of using either the XPathNavigator or XmlReader will be the same. Both will be traversing already parsed, in-memory nodes representing the XPath data model.
The main difference between the two is the XmlReader will provide forward-only access whereas the XPathNavigator provides cursor access to the document. Directly interacting with XmlReader is very useful when you don’t want to incur the cost of loading entire document in-memory. It’s not so useful otherwise.
I’d strongly suggest using the XPathNavigator.
There are two primary ways you can interact with the XPathNavigator: