I have a web application where I am trying to cache an XPathDocument.
The XPathDocument is created as follows.
XPathDocument xdoc = new XPathDocument(new StringReader(ruleXml));
Then I want to just cache this xdoc and retrieve it for each request.
And then I plan to call
XPathNavigator nav = xdoc.CreateNavigator();
on each thread.
My question is whether this is thread safe or not. Can you have multiple XPathNavigator classes on different threads with the same underlying XPathDocument?
If not I will just cache the ruleXml string and create a new XPathDocument on each thread.
Just wondering what peoples suggestions are in a scenario like this where I want to cache an xml read only document and then do different xpath queries on each thread.