Solved

Create XML file locally from downloaded XML

Posted on 2007-11-26
4
213 Views
Last Modified: 2013-11-26
Hi,

I am new to XML, so please bear with me.

I created an application where I download XML files. Most of them are in the same format. I want to create a local xml file, but I want to remove the stylesheet section ( <?xml-stylesheet type="bla,bla,bla/>). How can I do that? And how can I write that to file on my computer? I want to add a XSD ref, can I do that?

Let me know if you need more information.
Thanks
0
Comment
Question by:ALawrence007
  • 2
  • 2
4 Comments
 
LVL 7

Expert Comment

by:sj_hicks
ID: 20363379
Use system.net web.client.download data to download the XML file.
Load the XML doc into an system.xml.xmldocument and use the schemas property to play around with the associates schemas.
0
 

Author Comment

by:ALawrence007
ID: 20367658
sj_hicks,

Thanks for the reply. As I am a beginner, do you maybe have a sample that I can work of?

Thanks
0
 
LVL 7

Accepted Solution

by:
sj_hicks earned 500 total points
ID: 20370164
A, code sample below.  Currently untested, but shows the main commands required.

' Create a new WebClient instance.
Dim myWebClient As New WebClient()
' Download the home page data.
' DownloadData() method takes a 'uriRemote.ToString()' and downloads the Web resource and saves it into a data buffer.
Dim myDatabuffer As Byte() = myWebClient.DownloadData(remoteUrl)

' xmldata info xmldocument
Dim xmlDoc As new xmldocument
xmldoc.loadxml(Encoding.ASCII.GetString(myDataBuffer))

' add schema
xmldoc.Schemas.Add("http://www.blah.com", "blah.xsd")

' save xml
xmldoc.save(filename)


0
 

Author Closing Comment

by:ALawrence007
ID: 31411048
Thanks sj_hicks
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now