Click here to Skip to main content
15,908,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey guys, i wanted to ask if i can make the file name in XmlDocument load() dynamic. the reason i ask is because the examples i have seen online, the file names are statically placed in the load function.
C#
XmlDocument doc1 = new XmlDocument();
 doc1.Load("books.xml");


so can i do something like

C#
public loadXml (string filename)
{
 XmlDocument doc1 = new XmlDocument();
 doc1.Load(filename);
}


And also i read the documentation,but i am not sure. So i you can help me clarify, does the xmlDocument.load() call the XmlTextreader by default or am i gonna have to do that myself
[load Method^]
thanks for your help.
Posted
Updated 8-Oct-13 4:30am
v2

1 solution

Yes, you can.

Your are advised to try out what you are unsure about in little test programs and run them in debug mode to see what is happening.

This is a very powerful technique which will serve you even when you are skillful.
 
Share this answer
 
Comments
rudolph098 8-Oct-13 10:35am    
Thank you.And also i read the documentation,but i am not sure. So i you can help me clarify, does the xmlDocument.load() call the XmlTextreader by default or am i gonna have to do that myself
[load Method^]
Mehdi Gholam 8-Oct-13 10:39am    
Try and see.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900