Solved

Create XML file locally from downloaded XML

Posted on 2007-11-26
4
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

How our DevOps Teams Maximize Uptime

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

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

734 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