Question

I have two application client and server apps. My client application is checking xml then uploading it server. My server application is reading this xml. This is the senario.

I want to add a flag to xml in client side(Example ok,fail or 0,1 or true,false.)then upload it the server. Before reading it in server application, It will check the flag then read xml.

Note : My xml file size over 20 gb.

I tried to use Windows API Code Pack to add or edit File Properties but I couldn't.

How can I resolve this problem?

Was it helpful?

Solution

If you have full access to the file system and it is NTFS, you can probably use an alternate stream related to the file, but apart from the data.

For example you can write an Alternate Stream called flag with the TRUE value on command prompt by doing:

echo TRUE > C:\Path\file.xml:flag

Then, you can read the stream:

more < C:\Path\file.xml:flag

This will not change the file content.

There is no native .NET support for read/write NTFS alternate streams. But you can use WinApi p/invoke to access those streams: https://stackoverflow.com/a/604970/122195

enter image description here

OTHER TIPS

For reading and writing large xml files you should using SAX method instead of DOM. In C# there is an xmlreader class that use SAX method to read and wite your flag.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top