• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

Create XML file locally from downloaded XML

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
ALawrence007
Asked:
ALawrence007
  • 2
  • 2
1 Solution
 
sj_hicksCommented:
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
 
ALawrence007Author Commented:
sj_hicks,

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

Thanks
0
 
sj_hicksCommented:
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
 
ALawrence007Author Commented:
Thanks sj_hicks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now