vb.net - How can I create an XML file in Visual Basic? -


i asked write code interface wi-flight api in visual basic. have code login , interface api.

i writing sample code submit reservation. this, need create xml file , fill appropriate data entered in textfields sample code.

i have found various snippets of code on internet create basic files (source):

    <?xml version="1.0" encoding="utf-8"?>     <employees>       <employee>         <id>1</id>         <firstname>prakash</firstname>         <lastname>rangan</lastname>         <salary>70000</salary>       </employee>       <employee>         <id>5</id>         <firstname>norah</firstname>         <lastname>miller</lastname>         <salary>21000</salary>       </employee>       <employee>         <id>17</id>         <firstname>cecil</firstname>         <lastname>walker</lastname>         <salary>60000</salary>       </employee>     </employees> 

now, need create xml file this.

it requires me put things like

    <reservation name="unique-name"> 

i have not found way add name="unique-name" part xml file. looking way this.

very easy using xdocument/xelement:

dim v xelement = <reservation/> 'or dim v xelement = xelement.parse("<reservation/>") 'or dim v xelement = xelement.load("pathtofile") v.setattributevalue("name", "unique-name") debug.writeline(v.tostring) 'prints <reservation name="unique-name" /> 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -