Download Horizon :: Staff Members :: Save Vault :: XboxMB YouTube


Old 03-09-2012   #1 (permalink)
Regular Member
sixxkilur's Avatar
Join Date: Oct 2010
Posts: 27
Thanks: 1
Default Read and Write XML file

I am new to Vb and XML So how would I write a XML file like the following?


Code:
<?xml version="1.0" encoding="utf-8"?>
<Data>
  <Info>
    <Media ID="0048745.ini" Tid="0048745" TN="Get Bent" NT="480" TM="8500" DownloadLink="www.???.???" />
</Info>
</Data>
This is the code I use that does not work correctly.
Code:
Imports System.Xml

Public Class frmMain

    
    Private Sub btnCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreate.Click

        Dim settings As New XmlWriterSettings()
        settings.Indent = True
        Dim XmlWrt As XmlWriter = XmlWriter.Create(Application.StartupPath & "XmlTest.xml", settings)

        With XmlWrt
            .WriteStartDocument()
            '.WriteComment("This is a test file.")
            .WriteStartElement("Data")
            .WriteStartElement("Info")
            .WriteStartElement("Media")
            .WriteAttributeString("ID", value:="0048745.ini" & "Tid")
            .WriteEndElement()
            .WriteEndDocument()
            .Close()
        End With

        ShowXml()

    End Sub


How would I read the info in the XML into different text boxes?
Thank you for your help!

Last edited by sixxkilur; 03-09-2012 at 11:02 PM.
sixxkilur is offline Send a message via ICQ to sixxkilur Send a message via AIM to sixxkilur Send a message via MSN to sixxkilur Send a message via Yahoo to sixxkilur
Reply With Quote


Old 03-10-2012   #2 (permalink)
Regular Member
 
Join Date: Dec 2011
Posts: 91
Thanks: 114
Default Re: Read and Write XML file

One thing to Say ....

Sweet Home Alabama
LOL!
peluki is offline
Reply With Quote
The following users thanked this post: godzcheater, I report bugs


Old 03-10-2012   #3 (permalink)
Regular Member
sixxkilur's Avatar
Join Date: Oct 2010
Posts: 27
Thanks: 1
Default Re: Read and Write XML file

Quote:
Originally Posted by peluki View Post
One thing to Say ....

Sweet Home Alabama
LOL!
Oh come on smart @$$, that is not even relevant!

Your clues to the crypto was
A Deep South Band
Part of a Very Popular Quotation

Sweet Home Alabama was a good guess just based on that clue even though it was wrong. Meaning my response Sweet Home Alabama was completely relevant just incorrect.
sixxkilur is offline Send a message via ICQ to sixxkilur Send a message via AIM to sixxkilur Send a message via MSN to sixxkilur Send a message via Yahoo to sixxkilur
Reply With Quote




Old 03-10-2012   #4 (permalink)
Regular Member
 
Join Date: Dec 2011
Posts: 91
Thanks: 114
Default Re: Read and Write XML file

That 'One' Clever Comment! - have a guess! at why you say your coding doesn't work properly! - you might just guess right! - your coding is relevant to the problem - it just doesn't work properly, you say! - Would you like me to have a guess - Might? be something to do with your Code ...
peluki is offline
Reply With Quote
The following users thanked this post: I report bugs, Liquid44


Old 03-10-2012   #5 (permalink)
Regular Member
sixxkilur's Avatar
Join Date: Oct 2010
Posts: 27
Thanks: 1
Default Re: Read and Write XML file

I know that using & just addes the other

Code:
.WriteAttributeString("ID", value:="0048745.ini" & "Tid")
The code writes the XML as
Code:
<?xml version="1.0" encoding="utf-8"?>
<Data>
  <Info>
    <Media ID="0048745.iniTid" />
  </Info>
</Data>
Other methods I have tried also return errors or format the XML differently.
sixxkilur is offline Send a message via ICQ to sixxkilur Send a message via AIM to sixxkilur Send a message via MSN to sixxkilur Send a message via Yahoo to sixxkilur
Reply With Quote

Reply

Tags
net, xml

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 01:04 AM.


 

Powered by vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
COPYRIGHT (c) 2010 - 2013 - XboxMB - DESIGN BY:
EDENWEBS.COM