c# - How to create this kind of XML? -


i want create via c# code xml this:

<title>    <a>        <aaaaaaaaaaaaa/>    </a>    <b>        <bbbbbbbbbbbbb/>    </b> </title> 

with code should create tree thist?

well, if can use linq xml it's insanely easy:

xelement root = new xelement(     "title",     new xelement("a",         new xelement("aaaaaaaaaaaaa")),     new xelement("b",         new xelement("bbbbbbbbbbbbb")) ); 

additionally, if need build dynamically data (which will), can include queries within constructor calls, , work.

linq xml impressively easy-to-use api. of course, require .net 3.5 or higher.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -