Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
After I click the button, the file is generated, the xml file will update the nodes with those files created in the existing xml file and sum up all the nodes in the records.

How do I append the node into existing xml file?

What I have tried:

Content of xml file:

XML
<?xml version="1.0" encoding="utf-8"?>
<root>
	<rec>
		<totalrec>3
	
	<datas>
		<data>
			<id>000
			<file>20170111000U.TIF
			<file>20170111000R.TIF
		</data>
		<data>
			<id>001
			<file>20170111001U.TIF
			<file>20170111001R.TIF
		</data>
		<data>
			<id>002
			<file>20170111002U.TIF
			<file>20170111002R.TIF
		</data>
Posted
Updated 6-Nov-17 6:38am
v4
Comments
CHill60 6-Nov-17 11:52am    
What have you tried?
Maciej Los 6-Nov-17 12:39pm    
Your Xml is not valid xml content...

1 solution

Use an XmlReader to read the existing file, and an XmlWriter to create the updated version. see System.Xml Namespace[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900