Load a xml file on disc into two diffrent XmlDocuments

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have created to XmlDocument objects. Can they both .Load the same file? Or
if the first one loads a file is it locked? I am trying to load an xml file
again but the object's value keeps on being nothing.
 
Hi

Based on my test, two xmldocuments can work with one xml file.
Here is my test code.
XmlDocument doc = new XmlDocument();
doc.Load("c:\\test.xml");
Console.WriteLine(doc.FirstChild["computername"].InnerText);
XmlDocument doc1 = new XmlDocument();
doc1.Load("c:\\test.xml");
Console.WriteLine(doc1.FirstChild["computername"].InnerText);

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top