' use attributes for explicitly declaring serialization logic Public Property CompanyBranch As CompanyBranch XmlSerializer ClassĬreate classes which represent your data structures Public Class CompanyFile Dim companyBranchName As String = "My Company"ĭim customerName As String = "Some customer Ltd"Īnother approach is using serialization. You can use feature that only vb.net language have - XML Literals with embed expressions.
How can I create what I want One Node has List of elements then the list of elements may or may not have children or attributes.? Writer.WriteStartElement("Product_price") Private Sub createNode(ByVal pID As String, ByVal pName As String, ByVal pPrice As String, ByVal writer As XmlTextWriter) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clickĭim writer As New XmlTextWriter("product.xml", 8)ĬreateNode(1, "Product 1", "1000", writer)ĬreateNode(2, "Product 2", "2000", writer)ĬreateNode(3, "Product 3", "3000", writer)ĬreateNode(4, "Product 4", "4000", writer) I found a link that has basic XML format.
plus my top element have other elements.I mean my format is mucher longer but it looks like the below example:.
I found online Example but I struggled to understand how to add in some cases attributes and other cases child element. I want to create XML files from scratch in Visual studio using VB.net