473,405 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

save an xml stream to a file

Hi,

I am trying to download a file through a proxy which is causing me
lots of permission erors.

anyway after hacking at any and all code i could get my hands on, i
got this far, where the xml file is in the sLine stream. now i want
to save this stream to a local xml file but am having trouble doing
this.

<code>
Dim sURL As String
sURL = "http://test/rss.xml"

Dim wrGETURL As WebRequest
wrGETURL = WebRequest.Create(sURL)
Dim saByPassList() As String
Dim myProxy As New WebProxy("proxy:8080", True, saByPassList,
New NetworkCredential("user", "password", "_domain"))

myProxy.BypassProxyOnLocal = True

wrGETURL.Proxy = myProxy
'wrGETURL.Proxy = WebProxy.GetDefaultProxy()

Dim objStream As Stream
objStream = wrGETURL.GetResponse.GetResponseStream()

Dim objReader As New StreamReader(objStream)
Dim sLine As String = ""
Dim i As Integer = 0

Do While Not sLine Is Nothing
i += 1
sLine = objReader.ReadLine
If Not sLine Is Nothing Then
Console.WriteLine("{0}:{1}", i, sLine)
End If
Loop

Console.ReadLine()

</code>

Does anyone have any ideas for this.
Nov 20 '05 #1
2 1535
Hi,

Did you try something like this?

Dim dsXML As New DataSet
dsXML.ReadXml("http://msdn.microsoft.com/rss.xml")
dsXML.WriteXml("rss.xml")

Ken
---------------------
"kieran" <ki********@hotmail.com> wrote in message
news:b3*************************@posting.google.co m:
Hi,

I am trying to download a file through a proxy which is causing me
lots of permission erors.

anyway after hacking at any and all code i could get my hands on, i
got this far, where the xml file is in the sLine stream. now i want
to save this stream to a local xml file but am having trouble doing
this.

<code>
Dim sURL As String
sURL = "http://test/rss.xml"

Dim wrGETURL As WebRequest
wrGETURL = WebRequest.Create(sURL)
Dim saByPassList() As String
Dim myProxy As New WebProxy("proxy:8080", True, saByPassList,
New NetworkCredential("user", "password", "_domain"))

myProxy.BypassProxyOnLocal = True

wrGETURL.Proxy = myProxy
'wrGETURL.Proxy = WebProxy.GetDefaultProxy()

Dim objStream As Stream
objStream = wrGETURL.GetResponse.GetResponseStream()

Dim objReader As New StreamReader(objStream)
Dim sLine As String = ""
Dim i As Integer = 0

Do While Not sLine Is Nothing
i += 1
sLine = objReader.ReadLine
If Not sLine Is Nothing Then
Console.WriteLine("{0}:{1}", i, sLine)
End If
Loop

Console.ReadLine()

</code>

Does anyone have any ideas for this.


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.6 - Release Date: 6/25/2004
Nov 20 '05 #2
Cheers for response Ken.

That would work fine only for the proxy i have to go through so i
would need to feed the proxy and network credentials into the dataset
connection.
I have tried doing this but can't get it to work. Is this possible
using the code.

i am a newbie so am probably completely off track. I would greatly
appreciate if you could simply explain how to do this, or point me to
a good tutorial.

Cheers for help.
Ken Tucker [MVP] <vb***@bellsouth.net> wrote in message news:<uz**************@TK2MSFTNGP12.phx.gbl>...
Hi,

Did you try something like this?

Dim dsXML As New DataSet
dsXML.ReadXml("http://msdn.microsoft.com/rss.xml")
dsXML.WriteXml("rss.xml")

Ken
---------------------
"kieran" <ki********@hotmail.com> wrote in message
news:b3*************************@posting.google.co m:
Hi,

I am trying to download a file through a proxy which is causing me
lots of permission erors.

anyway after hacking at any and all code i could get my hands on, i
got this far, where the xml file is in the sLine stream. now i want
to save this stream to a local xml file but am having trouble doing
this.

<code>
Dim sURL As String
sURL = "http://test/rss.xml"

Dim wrGETURL As WebRequest
wrGETURL = WebRequest.Create(sURL)
Dim saByPassList() As String
Dim myProxy As New WebProxy("proxy:8080", True, saByPassList,
New NetworkCredential("user", "password", "_domain"))

myProxy.BypassProxyOnLocal = True

wrGETURL.Proxy = myProxy
'wrGETURL.Proxy = WebProxy.GetDefaultProxy()

Dim objStream As Stream
objStream = wrGETURL.GetResponse.GetResponseStream()

Dim objReader As New StreamReader(objStream)
Dim sLine As String = ""
Dim i As Integer = 0

Do While Not sLine Is Nothing
i += 1
sLine = objReader.ReadLine
If Not sLine Is Nothing Then
Console.WriteLine("{0}:{1}", i, sLine)
End If
Loop

Console.ReadLine()

</code>

Does anyone have any ideas for this.

Nov 20 '05 #3

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

Similar topics

2
by: gnv | last post by:
Hi all, I am writing a cross-browser(i.e. 6 and netscape 7.1) javascript program to save an XML file to local file system. I have an xml string like below: var xmlStr = "<?xml version="1.0"...
0
by: a | last post by:
Save text file as html kloepper 17:42 23 Jul '04 I'm using httpwebresponse and a StringBuilder to return a stream that originates as a file with the .txt suffix (My download code converts the html...
5
by: kevin | last post by:
Hi, Any help with this would be really appreciated! I'm trying to download a file from a remote server. The access permissions is okay but the problem I'm facing is that the file is getting...
9
by: Ivan Demkovitch | last post by:
Hi! I would like to know if I can save File on Server using server-side code? For example, I like to create thumbnail images and populate specific directory. Do I need specific permissions...
3
by: SveinErik | last post by:
Hi, I'm trying to find a method to save bmp, jpg and png files as ico files, 16x16 size. I have managed to convert and save bmp files to icon, but only in 32x32 size. I can't figure out how to save...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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
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,...
0
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...

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.