Hi All,
this is a string
"<SXPServerGetObjectsResult><Objects><Task><District Key="258627584">NL
KPN</District></Task></Objects></SXPServerGetObjectsResult>"
i want to store this into a xmlelement variable for further processing
this as xmlelement
How can i do it?
may u also tell me vicevers i.e. xmelement to string?
Any help would be appreciated by me.
Thanks,
Deepak
kr_deepak123@hotmail.com
kr_deepak123@yahoo.co.in
Martin Honnen - 08 Feb 2008 13:01 GMT
> this is a string
>
[quoted text clipped - 3 lines]
> i want to store this into a xmlelement variable for further processing
> this as xmlelement
There are various ways to achieve that, one is creating an
XmlDocumentFragment and set its InnerXml property e.g.
Dim doc As New XmlDocument()
Dim frag As XmlDocumentFragment = doc.CreateDocumentFragment()
frag.InnerXml = yourString
Dim element As XmlElement = CType(frag.FirstChild, XmlElement)
> may u also tell me vicevers i.e. xmelement to string?
xmlNodeInstance.OuterXml
see
<URL:http://msdn2.microsoft.com/en-us/library/system.xml.xmlnode.outerxml.aspx>

Signature
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Anthony Jones - 08 Feb 2008 13:06 GMT
> Hi All,
>
[quoted text clipped - 9 lines]
> may u also tell me vicevers i.e. xmelement to string?
> Any help would be appreciated by me.
You can use XmlDocuments LoadXml method and OuterXml property.
string sIn = @"<SXPServerGetObjectsResult><Objects>
<Task><District Key=""258627584"">NL
KPN</District></Task></Objects></SXPServerGetObjectsResult>";
XmlDocument dom = new XmlDocument();
dom.LoadXml(sIn);
//Manipulate XML using dom.documentElement
Console.WriteLine(dom.OuterXml);

Signature
Anthony Jones - MVP ASP/ASP.NET
deepak - 08 Feb 2008 16:42 GMT
yeah its working after using outer xmlproperty.
Thanks a lot Anthony and Martin...u really helped me in crucial time..u
dont know that how much will be this thing be helpful for me and my
project....Thanks again...u can add me in hotmail or yahoo or mail me your id
on my mail.My ids are given below
-Deepak
kr_deepak123@hotmail.com
kr_deepak123@yahoo.co.in
> > Hi All,
> >
[quoted text clipped - 23 lines]
>
> Console.WriteLine(dom.OuterXml);