I have xml file in string. I do not have right to write on disk. how to pass this string to XPathDocument?
XPathDocument Doc = new XPathDocument(xmlFile);
You should be able to accomplish this by converting the string to a stream, then using the XPathDocument(Stream) constructor:
string xmlFile; // TODO get string
byte[] byteArray = Encoding.ASCII.GetBytes( xmlFile );
MemoryStream stream = new MemoryStream( byteArray );
var Doc = new XPathDocument( stream );