CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    George2 is offline Elite Member Power Poster
    Join Date
    Oct 2002
    Posts
    4,468

    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

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    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.

  3. #3
    George2 is offline Elite Member Power Poster
    Join Date
    Oct 2002
    Posts
    4,468

    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);
    Quote 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

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: XPathDocument Constructor

    Quote 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
  •  





Click Here to Expand Forum to Full Width

Featured