Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / July 2006

Tip: Looking for answers? Try searching our database.

String to XML

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Java Apache - 27 Jul 2006 19:39 GMT
Hi All,

I am pretty to new to .NET/C# so go easy (sorry for X-Post, but I am not
sure my other post reached the C# list!)!

I am developing a Web Service call to a Java Web Service and it is all
working fine - it is returning me back a String value which in all
reality is an XML file (the content of the string is a valid well-formed
XML packet).  How can I get this string into an XML object so I can use
the XML functions / operations in .NET?  An example of my XML String is
below:

<?xml version="1.0" encoding="UTF-8"?>
<NOVA version="1.0">
<PROCESSGUID>B1367940-802E-9665-4305EF47E9AC81F1</PROCESSGUID>
<REQUEST><USERNAME>foo</USERNAME><PASSWORD>foo</PASSWORD>
<COMPONENT>Test</COMPONENT>
<ARGUMENTS><address>earth</address><foo>earth</foo></ARGUMENTS>
<METHOD>foo</METHOD></REQUEST><RESPONSE><SUCCESS>true</SUCCESS><RESULT>I
worked!</RESULT><RESPONSEDATETIME>2006-07-27
18:19:35</RESPONSEDATETIME><ERROR>
<TYPE/><CODE/><MESSAGE/><DETAIL/></ERROR></RESPONSE></NOVA>

How could I get say, the "SUCCESS" value from this string

Hope some of you gurus can help ;-P

Thanks
Scott M. - 27 Jul 2006 20:55 GMT
You could load the string into a StringReader and then into a DataSet and
extract what you need via ADO.NET or you could load the string into an
XMLDocument object and use the XMLDOM to parse it.

> Hi All,
>
[quoted text clipped - 23 lines]
>
> Thanks
Michael Mooney - 28 Jul 2006 17:05 GMT
System.Xml.XmlDocument objDocument = new System.Xml.Document();
objDocument.LoadXml(strXmlValueReturnedFromWebService);
System.Xml.XmlNode objNode =
objDocument.SelectSingleNode("/NOVA/RESONSE/SUCCESS");

> Hi All,
>
[quoted text clipped - 23 lines]
>
> Thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.