"Michael Jesse" <mi**************@sbcglobal.net> wrote in message news:tU******************@newssvr30.news.prodigy.c om...
I am currently using XML to store game data, user/member data, and other.
Assuming a user base of 10,000 active users, is there a conflict if one
user is updating information and another user is creating data on the
same xml file?
Yes. Files can't handle concurrent writers very well, this is why there
are databases.
User 1: update inventory that exists in the XML file
This causes a problem if the 'inventory' contains a different number
of characters than it did before.
<characters>
<character id="frodo">
</character>
<character id="samwise">
<inventory>
<item>Elven Rope</item>
</inventory>
</character>
</characters>
Now, assume you edit that item to be "Elven Rope 50m" in a text
file, now it's corrupted.
<characters>
<character id="frodo">
</character>
<character id="samwise">
<inventory>
<item>Elven Rope 50mem>
</inventory>
</character>
</characters>
User 2: new user adding their inventory data in the XML file
If Frodo adds the One Ring to his inventory, this is one possible
outcome,
<characters>
<character id="frodo">
<inventory>
<item>The One Ring</item>
</inventory>
</character>e</item>
</inventory>
</character>
</characters>
Windows tries to prevent this from happening by granting the writer an
exclusive write lock (which you have to request) and giving everyone else
who requests that write lock nothing. However, any changes to the file
would need to be reloaded by all readers, or writes they may commit
would corrupt the file as illustrated above.
Derek Harmon