Edit a XML File using VC++
Hi All,
I am working on VC++.
I have a file named abc.xml and somewhere in the middle there is a statement "Value = 5". Now i want to change the value to 15.
I started this by using a CFile object,opened in ReadWrite mode but i am not able to proceed further. How do i search for the Tag "Value" since i found no functions similar to CString::Find in CFile Object.
i hav tried the option of reading the file contents into a buffer and then change the value.this works but i do not want to use this approach since the file size can b huge some times.
Is there an alternate solution for this ?
Thanks in advance
[664 byte] By [
Kris_V] at [2007-11-19 10:22:12]

# 2 Re: Edit a XML File using VC++
For working with huge XML files in VC++ the best option is probably the SAX parser that comes with MSXML.
khp at 2007-11-10 3:28:23 >

# 3 Re: Edit a XML File using VC++
I found the MSXML SAX parser very difficult to use in C++, and the documentation was weak at best. I have gotten much further using Xerces C++ parser.
Is there a reason you prefer the MSXML parser to the Xerses for large files, khp?
edit: Nevermind, I just realized you meant VC++.
Benjay at 2007-11-10 3:29:32 >

# 4 Re: Edit a XML File using VC++
edit: Nevermind, I just realized you meant VC++.
Exactly, I assume MSXML is more easily used from VC++ than Xerces.
Truth be told I have absolutly no experience with MSXML (other than frustrating efforts trying to help the poor souls using MSXML), nor do I have any experience using Xerces's SAX implementation.
So I regret to admit that my answer is based on nothing but assumptions :(
khp at 2007-11-10 3:30:27 >

# 5 Re: Edit a XML File using VC++
Using the MSXML Parser to Work with XML Documents (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncdev00/html/vc00k1.asp)
Using the Microsoft XML Parser to Create XML Documents (http://www.dev-archive.com/Cpp/data/data-misc/xml/article.php/c4585/)
There are also some wrapper classes within the XML section (http://www.dev-archive.com/Cpp/data/data-misc/xml/) here at dev-archive (http://www.dev-archive.com)...