473,508 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Manipulate XML File

Assume you're working with a vendor that doesn't understand web
services and implements their version of a web service solution that
only returns an XML file upon making a call to a URL:

http://333.333.333.90:7900/UserVerif...c&Password=123

There is no disco file of any sort, so I'm forced to write code that does
a post/get and captures the XML file returned and parses it manually to
get to the data.

Using a .Net solution, what's the best approach to solving this problem?

Thanks for any pointers.

Nov 19 '05 #1
2 1046
You'll want to load the document into a DOM parser, and go from there:

XmlDocument doc = new XmlDocument();
doc.Load("http://333.333.333.90:7900/UserVerify?UserID=abc&Password=123");

XmlNode someNode = doc.SelectSingleNode("/somenodename");
string someValue = someNode.InnerText;

Check the docs for parsing XML documents using the XmlDocument object


"Garth Wells" <no****@ishome.com> wrote in message
news:u4**************@TK2MSFTNGP15.phx.gbl...
Assume you're working with a vendor that doesn't understand web
services and implements their version of a web service solution that
only returns an XML file upon making a call to a URL:

http://333.333.333.90:7900/UserVerif...c&Password=123

There is no disco file of any sort, so I'm forced to write code that does
a post/get and captures the XML file returned and parses it manually to
get to the data.

Using a .Net solution, what's the best approach to solving this problem?

Thanks for any pointers.

Nov 19 '05 #2
Edo
Garth,

You make a post like this (I'm posting an XML here):

using System.Net;

HttpWebRequest request = (HttpWebRequest)
WebRequest.Create(alurl);
request.Method = "POST";
request.ContentType = "text/xml";
Stream postStream = request.GetRequestStream();
StreamWriter sw = new StreamWriter(postStream);
sw.Write(xml);
sw.Flush();
sw.Close();
// reading
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
response.Close();

To parse XML:

using System.Xml;

XmlDocument formDoc = new XmlDocument();
formDoc.LoadXml(xmlString);
formDoc.GetElementsByTagName("sometag");

Hope this helps

Ed.

"Garth Wells" wrote:
Assume you're working with a vendor that doesn't understand web
services and implements their version of a web service solution that
only returns an XML file upon making a call to a URL:

http://333.333.333.90:7900/UserVerif...c&Password=123

There is no disco file of any sort, so I'm forced to write code that does
a post/get and captures the XML file returned and parses it manually to
get to the data.

Using a .Net solution, what's the best approach to solving this problem?

Thanks for any pointers.

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2542
by: Paul | last post by:
This method: static void swap(int a, int b) { int c = a; a = b; b = c; } does not swap the values of a and b over. It doesn't work for String variables either. However the following method...
6
1866
by: Tim | last post by:
I need to manipulate files (rtf and wav files) on the server side. Can you show me how to do that? Thank you,
1
1260
by: Andreas Palm | last post by:
I have the problem that when I write XML from a dataset I get certain columns that are empty not as empty elements, rather not at all. To avoid that I thought I can go to the dataset and easily...
8
2080
by: Steve Jorgensen | last post by:
Hi all, I was wondering if anyone has been able to find a way to read layout information and manipulate the layout in the Relationships window. I've tried a few different angles, but couldn't...
2
1519
by: Guogang | last post by:
Is it possible to manipulate client computer's direcotries through an ASP.NET page? For example: user click "Down Load Package To Temporary Directory", then a whole package with proper directory...
0
982
by: intec studenf | last post by:
Is it possible to retrieve and manipulate the description attributes (meta info?) from an image file, using asp.net? In windows you can give an image (for example a jpg file) through the...
2
1173
by: Steve Hershoff | last post by:
Hi everyone, I'm going to manipulate some XML files in my next project-- crawl through the tags, compare if file X has the same nodes as file Y, and if not, what the differences are and who's...
1
1158
by: Ron | last post by:
I would like to write a small program to manipulate this XML: http://www.keepitsimplekid.com/xml/Ad00304.xml What I want the program to do. it would look at all.xml documents in a directory...
4
1552
by: isakb | last post by:
Hi, I am quite new to Python, and the following puzzles me, maybe there is someone here who can tell me what is wrong? I have a list of words in a plain textfile (encoded in latin-1). There is...
0
7321
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7377
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5047
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4705
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1547
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
414
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.