Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 27th, 2006, 07:35 PM
Java Apache
Guest
 
Posts: n/a
Default String to XML

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
  #2  
Old July 27th, 2006, 08:45 PM
Scott M.
Guest
 
Posts: n/a
Default Re: String to XML

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.

"Java Apache" <teammacromedia@ukonline.co.ukwrote in message
news:QL7yg.24007$9d4.23966@fe2.news.blueyonder.co. uk...
Quote:
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

  #3  
Old July 28th, 2006, 05:05 PM
Michael Mooney
Guest
 
Posts: n/a
Default Re: String to XML

System.Xml.XmlDocument objDocument = new System.Xml.Document();
objDocument.LoadXml(strXmlValueReturnedFromWebServ ice);
System.Xml.XmlNode objNode =
objDocument.SelectSingleNode("/NOVA/RESONSE/SUCCESS");

"Java Apache" <teammacromedia@ukonline.co.ukwrote in message
news:QL7yg.24007$9d4.23966@fe2.news.blueyonder.co. uk...
Quote:
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

 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles