Hello all,
Im trying to write an XML to a file from the save as.
My program reads an XML file, loads all the values in from the Attributes in the XML file, then it needs to save it only editing the Attributes frome the specific objects in the xml, in the exact same form it was read, just with the new Attributes.
Ive been searching everywhere, and I cant find help anywhere. All sites are always talking about database editing - i am not connecting to a database in any way, I am just editing a specific type of XML file.
Every single thing works in the program except writing to a NEW xml file.
I dont want to write to the same XML file, or to a predefined "file.xml" i need it to collect the info from SaveDialog1.Filename
All the info i find on the net is all for database or to save it to a specific file pre-defined in code. I need it to get the new filename the user puts in from the save as dialog.
this is my loading the XML file and getting the attributes.
I need to know how to get the parsed data and put it back into the XML code into a NEW document. I have found info on this, including on the MSDN but it doesnt provide enough details ever and doesnt go into detail with examples. I am very very new to VB (Ive only been using it for 2 days), so please give me some easy-to-understand information.
Ive gotten this far into it, its a simple application, i got everything loaded, all the values changing properly etc. Now all I need to do is save it to an XML file.
if you can help me, please get back to me ASAP.
I will repost in this thread with the solution as well as a code example that lists how to do it so other people who are trying to do what I am doing might have a better chance of finding it.
THis is very BASE level xml editing, please help me
Id prefer a repost on here,
but you can e-mail me
contact me on aim - Kedhrin
msn - Kedhrin@yahoo.com
ICQ - 52477482
YAHOO - Kedhrin@yahoo.com
the only applications ill be writing in visual basic all detail with specific XML flies, not ever connecting to a database. I dont HAVE to do this, but it helps me out at work BIG TIME.
once I figure out how to save these files, I can probably edit future XML files without much problems.
Im using Visual Basic Express Beta.
Thank you!!!
Im trying to write an XML to a file from the save as.
My program reads an XML file, loads all the values in from the Attributes in the XML file, then it needs to save it only editing the Attributes frome the specific objects in the xml, in the exact same form it was read, just with the new Attributes.
Ive been searching everywhere, and I cant find help anywhere. All sites are always talking about database editing - i am not connecting to a database in any way, I am just editing a specific type of XML file.
Every single thing works in the program except writing to a NEW xml file.
I dont want to write to the same XML file, or to a predefined "file.xml" i need it to collect the info from SaveDialog1.Filename
All the info i find on the net is all for database or to save it to a specific file pre-defined in code. I need it to get the new filename the user puts in from the save as dialog.
this is my loading the XML file and getting the attributes.
Code:
Public Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
OpenFileDialog1.ShowDialog()
If ShowDialog.OK Then
TextFile.Text = OpenFileDialog1.FileName
Dim m_xmlr As XmlTextReader
m_xmlr = New XmlTextReader(OpenFileDialog1.FileName)
m_xmlr.WhitespaceHandling = WhitespaceHandling.None
m_xmlr.Read()
m_xmlr.Read()
m_xmlr.Read()
m_xmlr.Read()
m_xmlr.Read()
While Not m_xmlr.EOF
m_xmlr.Read()
If Not m_xmlr.IsStartElement() Then
Exit While
End If
Dim hTop = m_xmlr.GetAttribute("hTopColor")
Dim hBottom = m_xmlr.GetAttribute("hBottomColor")
Dim sLight = m_xmlr.GetAttribute("dDifuse")
Dim sDirection = m_xmlr.GetAttribute("dDirection")
Dim fDensity = m_xmlr.GetAttribute("fDensity")
Dim fStart = m_xmlr.GetAttribute("fStart")
Dim fColor = m_xmlr.GetAttribute("fColor")
Dim TopColor As String
Dim Topstrs() As String
TopColor = hTop
Topstrs = TopColor.Split(",")
Button4.BackColor = System.Drawing.Color.FromArgb(Topstrs(0), Topstrs(1), Topstrs(2))
ColorDialog1.Color = System.Drawing.Color.FromArgb(Topstrs(0), Topstrs(1), Topstrs(2))
Dim BottomColor As String
Dim Bottomstrs() As String
BottomColor = hBottom
Bottomstrs = BottomColor.Split(",")
Button5.BackColor = System.Drawing.Color.FromArgb(Bottomstrs(0), Bottomstrs(1), Bottomstrs(2))
ColorDialog2.Color = System.Drawing.Color.FromArgb(Bottomstrs(0), Bottomstrs(1), Bottomstrs(2))
Dim sColor As String
Dim sstrs() As String
sColor = sLight
sstrs = sColor.Split(",")
Button6.BackColor = System.Drawing.Color.FromArgb(sstrs(0), sstrs(1), sstrs(2))
ColorDialog3.Color = System.Drawing.Color.FromArgb(sstrs(0), sstrs(1), sstrs(2))
Dim Colorf As String
Dim fstrs() As String
Colorf = fColor
fstrs = Colorf.Split(",")
Button7.BackColor = System.Drawing.Color.FromArgb(fstrs(0), fstrs(1), fstrs(2))
ColorDialog4.Color = System.Drawing.Color.FromArgb(fstrs(0), fstrs(1), fstrs(2))
Dim sDir As String
Dim sDirstrs() As String
sDir = sDirection
sDirstrs = sDir.Split(",")
X.Text = sDirstrs(0)
Y.Text = sDirstrs(1)
Z.Text = sDirstrs(2)
Density.Text = fDensity
Start.Text = fStart
End While
m_xmlr.Close()
End If
If ShowDialog.Cancel Then
Exit Sub
End If
End Sub
I need to know how to get the parsed data and put it back into the XML code into a NEW document. I have found info on this, including on the MSDN but it doesnt provide enough details ever and doesnt go into detail with examples. I am very very new to VB (Ive only been using it for 2 days), so please give me some easy-to-understand information.
Ive gotten this far into it, its a simple application, i got everything loaded, all the values changing properly etc. Now all I need to do is save it to an XML file.
if you can help me, please get back to me ASAP.
I will repost in this thread with the solution as well as a code example that lists how to do it so other people who are trying to do what I am doing might have a better chance of finding it.
THis is very BASE level xml editing, please help me
Id prefer a repost on here,
but you can e-mail me
contact me on aim - Kedhrin
msn - Kedhrin@yahoo.com
ICQ - 52477482
YAHOO - Kedhrin@yahoo.com
the only applications ill be writing in visual basic all detail with specific XML flies, not ever connecting to a database. I dont HAVE to do this, but it helps me out at work BIG TIME.
once I figure out how to save these files, I can probably edit future XML files without much problems.
Im using Visual Basic Express Beta.
Thank you!!!