Problem with saving new elements in my xml at right level
Posted
by
Fore
on Stack Overflow
See other posts from Stack Overflow
or by Fore
Published on 2011-01-07T11:37:56Z
Indexed on
2011/01/07
11:54 UTC
Read the original article
Hit count: 407
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
© Stack Overflow or respective owner