473,666 Members | 2,713 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 1052
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?User ID=abc&Password =123");

XmlNode someNode = doc.SelectSingl eNode("/somenodename");
string someValue = someNode.InnerT ext;

Check the docs for parsing XML documents using the XmlDocument object


"Garth Wells" <no****@ishome. com> wrote in message
news:u4******** ******@TK2MSFTN GP15.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.Crea te(alurl);
request.Method = "POST";
request.Content Type = "text/xml";
Stream postStream = request.GetRequ estStream();
StreamWriter sw = new StreamWriter(po stStream);
sw.Write(xml);
sw.Flush();
sw.Close();
// reading
HttpWebResponse response = (HttpWebRespons e)request.GetRe sponse();
response.Close( );

To parse XML:

using System.Xml;

XmlDocument formDoc = new XmlDocument();
formDoc.LoadXml (xmlString);
formDoc.GetElem entsByTagName(" 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
2552
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 does swap the first two
6
1874
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
1267
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 manipulate the schema in the way that I force a minoccurs 1 to make the empty elements to appear in my file. How can I manipulate the dataset schema ? regards andreas
8
2089
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 find anything. Thanks, - Steve J.
2
1530
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 structure will be downloaded to client computer's c:\temp directory. Thanks, Guogang
0
1006
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 properties screen, a title, subject, comments etc. We would like to use this, to store the information directly into the image instead of a database or xml file. Thanks in advance for your response.
2
1179
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 missing what. I'll also be comparing values between nodes in the two files, for when both documents do have the same named nodes. What .Net classes should I be looking at to accomplish these tasks? Thanks a bunch.
1
1173
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 for example directory C:\XML\rename A Rename button would be pressed on the form and the program would go
4
1562
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 one word per line, and 106299 words in total. I want to load the words to a list because I want to manipulate them, and then write them to a different file... The mystery for me is that the new file only contains 106211 lines, even though I have...
0
8863
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8779
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7376
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6187
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5660
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4186
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4356
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1761
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.