|
-
May 15th, 2008, 12:57 AM
#1
XPathDocument Constructor
Hello everyone,
When use the following XPathDocument Constructor, we can not open the XML file in exclusive mode. Any ideas about how to open an XML file in exclusive mode and using XPath Query?
http://msdn.microsoft.com/en-us/libr...95(VS.80).aspx
thanks in advance,
George
-
May 15th, 2008, 03:02 AM
#2
Re: XPathDocument Constructor
The link you provided points to the constructor that takes a string parameter to the file path.
Now without giving you the answer directly, I ask you to determine if there are other XPathDocument constructors that you can use that will enable you to open a file with an exclusive lock and use one of these other constructors.
-
May 15th, 2008, 03:06 AM
#3
Re: XPathDocument Constructor
Thanks for your hint, Arjay!
I have written some code, could you review whether it is correct solution please? :-)
Code:
FileStream fs = new FileStream("foo.txt", FileMode.Open, FileAccess.Read, FileShare.None);
XPathDocument xp = new XPathDocument(fs);
 Originally Posted by Arjay
The link you provided points to the constructor that takes a string parameter to the file path.
Now without giving you the answer directly, I ask you to determine if there are other XPathDocument constructors that you can use that will enable you to open a file with an exclusive lock and use one of these other constructors.
regards,
George
-
May 15th, 2008, 03:20 AM
#4
Re: XPathDocument Constructor
 Originally Posted by George2
Thanks for your hint, Arjay!
I have written some code, could you review whether it is correct solution please? :-)
Code:
FileStream fs = new FileStream("foo.txt", FileMode.Open, FileAccess.Read, FileShare.None);
XPathDocument xp = new XPathDocument(fs);
regards,
George
C'mon George, don't ask for this. Test the code yourself. (Hint: use the forum when you've exhausted all the other options).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|