Problem with saving new elements in my xml at right level
- by Fore
I have a xml file that looks like this:
<DataTalk>
<Posts>
<TalkPost>
<PostType>dialog</PostType>
<User>ABBE</User>
<Customer>HRM - Heroma</Customer>
<PostedDate>0001-01-01T00:00:00</PostedDate>
<Message>TEST</Message>
</TalkPost>
</Posts>
</DataTalk>
When I now want to save new elements, I do:
document.root.add((new XElement("TalkPost", new XElement("PostType", newDialog.PostType),
new XElement("User", newDialog.User), new XElement("Customer", newDialog.Customer),
new XElement("PostedDate", newDialog.PostDate), new XElement("Message", newDialog.Message)));
The problem is now that it gets saved at the wrong hierarchal level. They all gets saved under <datatalk> and not under <posts> that I wan't to. How should I do to save the new elements under the <posts> hierarchically