Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
9
Reply
Appending new tag and attribute values to the existing xml file through code behind
mahesh
Jul 25 2011 6:57 AM
1.6k
Reply
Dear All,
I want to append tag and attribute values to the existing xml file.Here is my code
Strpath = AppDomain.CurrentDomain.BaseDirectory.ToString & "data.xml"
Dim doc As XDocument = XDocument.Load(Strpath)
Dim xmlnode As XElement = doc.<Strpath>(0)
'Dim xmleleattr As XElement
Dim xmleleattr As XElement = _
<Student>
<Name>
<%= David %>
</Name>
<Address>
<%= Royal street %>
</Address>
<PhoneNumber>
<%= 98767896%>
</PhoneNumber>
<Email>
<%=
[email protected]
%>
</Email>
</Student>
xmlnode.Add(New XElement(xmleleattr)) // in this line i,m getting an error that object reference not set to an instance of an object.
xmlnode.Save(Strpath)
Thanks in advance.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
9
)
Next Recommended Forum
The process cannot access the xml file
LINQ to XML