473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

XDocument Exclusive Access

Tom
I can successfully do the following:

xdocument doc = xdocument.load(... my file);
xelement bla = doc.descendants.("it").first();
.... do stuff ...
doc.save("myfile");

the above works great. however, i want to interact with the file with
exclusive access so that no other files can open it/write to it/etc. while
i'm doing stuff with it.

i know that there's the normal FileStream.open (etc., fileshare.none), but
the xdocument class doesn't take a stream as a constructor.

is there any way i can do this without having to use the xmldocument class?

Thanks.

Oct 7 '08 #1
3 4408
Hi Tom,

For example like this XDocument.Load(new XmlTextReader(new FileStream .....

ps. mind 'using' statement

Regards, Alex Meleta
[TechBlog] http://devkids.blogspot.com
I can successfully do the following:

xdocument doc = xdocument.load(... my file);
xelement bla = doc.descendants.("it").first();
... do stuff ...
doc.save("myfile");
the above works great. however, i want to interact with the file with
exclusive access so that no other files can open it/write to it/etc.
while i'm doing stuff with it.

i know that there's the normal FileStream.open (etc., fileshare.none),
but the xdocument class doesn't take a stream as a constructor.

is there any way i can do this without having to use the xmldocument
class?

Oct 7 '08 #2
Tom
thanks alex,

that seems like the right idea, but it didn't seem to work. i get the
following exception:
"non white space characters cannot be added to content"

it looks like the constructor for the xdocument class can only take any of
the following:
1. nothing (e.g. - xdocument())
2. params object[] content
3. xdocument other
4. xdeclaration declaration, params object[] content

so i think when i try to use your example below, my guess is that it's
trying to add the new xmltextreader as content. any other ideas? i'll keep
playing with this one though.

thanks again.
-- tom
"Alex Meleta" <am*****@gmail.comwrote in message
news:df*************************@news.microsoft.co m...
Hi Tom,

For example like this XDocument.Load(new XmlTextReader(new FileStream
.....

ps. mind 'using' statement

Regards, Alex Meleta
[TechBlog] http://devkids.blogspot.com
>I can successfully do the following:

xdocument doc = xdocument.load(... my file);
xelement bla = doc.descendants.("it").first();
... do stuff ...
doc.save("myfile");
the above works great. however, i want to interact with the file with
exclusive access so that no other files can open it/write to it/etc.
while i'm doing stuff with it.

i know that there's the normal FileStream.open (etc., fileshare.none),
but the xdocument class doesn't take a stream as a constructor.

is there any way i can do this without having to use the xmldocument
class?

Oct 7 '08 #3
Tom
thanks alex. this actually worked like a charm. it's early, and i'm not
awake yet.
"Alex Meleta" <am*****@gmail.comwrote in message
news:df*************************@news.microsoft.co m...
Hi Tom,

For example like this XDocument.Load(new XmlTextReader(new FileStream
.....

ps. mind 'using' statement

Regards, Alex Meleta
[TechBlog] http://devkids.blogspot.com
>I can successfully do the following:

xdocument doc = xdocument.load(... my file);
xelement bla = doc.descendants.("it").first();
... do stuff ...
doc.save("myfile");
the above works great. however, i want to interact with the file with
exclusive access so that no other files can open it/write to it/etc.
while i'm doing stuff with it.

i know that there's the normal FileStream.open (etc., fileshare.none),
but the xdocument class doesn't take a stream as a constructor.

is there any way i can do this without having to use the xmldocument
class?

Oct 7 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Alan Jones | last post by:
Access 2000 onwards introduced a restriction that only allows you to edit and save forms, reports and macros when you have exclusive access to the database, i.e. no other user has the database...
1
by: JohnC | last post by:
I have this exact same scenario. It is new and seems to be related to when we installed Adobe 7.0 Standard/Professional. We have an MDB on a LAN file server. Using Access 2K and Windows 2K. ...
18
by: Andre Laplume via AccessMonster.com | last post by:
I have inherited a bunch of dbs which are are shared among a small group in my dept. We typically use the dbs to write queries to extract data, usually dumping it into Excel. Most dbs originated...
0
by: MSDN | last post by:
Hi can anybody help me. I am trying to access a database I have created, using ADO. The code is fine but the Jet Engine returns an exclusive Access error Error tells me that the database is...
1
by: CJJ | last post by:
hi Folks, I am opening my access database file (Access 2003) from a C# application. The connection string specifies mode=Share Exclusive The intent is that the application have exclusive...
4
GrandMaster
by: GrandMaster | last post by:
Hi all When I used Access 97, I could edit reports and forms whilst other users had it open, the only problem was that the users had to close and reopen a form or report to see the form/report in...
1
by: PW | last post by:
Hi, All of a sudden one of our clients can't use her application. She gets "You don't have exclusive access to your database at this time" when trying to open our application. The only thing...
2
by: Zippy | last post by:
I recently updated one of my clients from Access 97 front-end to Access 2003. (Database still in 97 format). They have about 5 networked PCs. On one of these PCs only, the user gets a warning...
2
by: ARC | last post by:
Hello all, When a user starts my app, I run re-attaching code if the links are not valid, etc. In this routine, I then check the version of the back-end database. If the version is off, I run...
3
by: Tom | last post by:
I can successfully do the following: xdocument doc = xdocument.load(... my file); xelement bla = doc.descendants.("it").first(); .... do stuff ... doc.save("myfile"); the above works great. ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.