this format should be generated without using xmldocument class . i am loading the document in one class and from that class i am calling a method of the class where the xmlnode be generated and it will return the xmlnode to the class where from it was
called. so that i can append it to doument and save...
In my mind,XmlDocument or XDocument can help you to create an xml Text easily and pass it as a parameter to the end point……;But if you don't like that,you have to use StringBuilder to deal with the problem,sample looks like this:
StringBuilder sbu = new StringBuilder();
sbu.Append("<loginuser>");
sub.Append(Environment.NewLine); //Start with a new line……
sub.Append("………………");
………………
return sbu.ToString();
Santosh Kuma...
Member
8 Points
14 Posts
creating xmlnode without xmldocument class
Feb 17, 2012 09:07 AM|LINK
Hi
i am trying to create a xmlnode like
<logdetail>
<a>sdsd</a>
<b>sdasds</b>
</logdetail>
this format should be generated without using xmldocument class . i am loading the document in one class and from that class i am calling a method of the class where the xmlnode be generated and it will return the xmlnode to the class where from it was called. so that i can append it to doument and save...
i am really stuck in it... can anyone HELP
Sum8
Contributor
4141 Points
931 Posts
Re: creating xmlnode without xmldocument class
Feb 17, 2012 11:08 AM|LINK
If you want do this using simple string concatenation, refer below sample code:
protected string fnGenerateXMLNode(string strNodeName, string strVal1, string strVal2) { return "<" + strNodeName + "> <a>" + strVal1 + "</a> <b>" + strVal2 + "</b> </" + strNodeName + ">"; }Sumit Pathak
------------------
ThisPost = Helped == True ? "Mark As Answer" : "Elaborate your problem in more details"
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: creating xmlnode without xmldocument class
Feb 19, 2012 12:42 AM|LINK
Hello Santosh:)
In my mind,XmlDocument or XDocument can help you to create an xml Text easily and pass it as a parameter to the end point……;But if you don't like that,you have to use StringBuilder to deal with the problem,sample looks like this:
StringBuilder sbu = new StringBuilder(); sbu.Append("<loginuser>"); sub.Append(Environment.NewLine); //Start with a new line…… sub.Append("………………"); ……………… return sbu.ToString();