AshleyRP 8/6/2008 11:28:34 AM

XML creation

I am trying to get data from a windows form into an xml file. The xml file has a parent node of <Orders> with child nodes <Order>. I am having trouble getting <Order> into <Orders>. I am just getting multiple parent nodes of <Order>. The text in each respective textbox is put into the correct fields, I just can't seem to figure out how to the get parent node in place. Here is my code. What do I need to add in order to create the <Orders> parent node and have the <Order> objects within it? I know this isn't exactly an eConnect question, but it is related as this is the program we want to use to create the file for eConnect to create our invoices in GP.

Where the <Order> is created....

Public Sub CreateOrder()

o = New Order

o.OrderID = tbOrderID.Text

o.Name = tbName.Text

o.Company = tbCompany.Text

o.Address1 = tbAddress1.Text

o.Address2 = tbAddress2.Text

o.Address3 = tbAddress3.Text

o.City = tbCity.Text

o.State = cbState.SelectedItem

o.Zip = tbZip.Text

o.Shipping = cbShipping.SelectedItem

o.Email = ""

o.Phone = tbPhone.Text

o.Qty = tbQty.Text

o.ItemNo = tbItemNo.Text

Dim objStreamWriter As New StreamWriter("C:\FlukerOrders.xml", 1)

Dim length As New Integer

length = OrderCol.Count

x =
New XmlSerializer(o.GetType)

x.Serialize(objStreamWriter, o)

objStreamWriter.Close()

End Sub

THIS IS THE ORDER CLASS THAT CREATES THE DATA FOR THE ORDER....

Public Class Order

Private strName As String

Private strOrderID As String

Private strCompany As String

Private strAddress1 As String

Private strAddress2 As String

Private strAddress3 As String

Private strCity As String

Private strState As String

Private strZip As String

Private strShipping As String

Private strEmail As String

Private strPhone As String

Private strQty As String

Private strItemNo As String

Public Property OrderID() As String

Get

OrderID = strOrderID

End Get

Set(ByVal Value As String)

strOrderID = Value

End Set

End Property

Public Property Name() As String

Get

Name = strName

End Get

Set(ByVal Value As String)

strName = Value

End Set

End Property

Public Property Company() As String

Get

Company = strCompany

End Get

Set(ByVal Value As String)

strCompany = Value

End Set

End Property

Public Property Address1() As String

Get

Address1 = strAddress1

End Get

Set(ByVal Value As String)

strAddress1 = Value

End Set

End Property

Public Property Address2() As String

Get

Address2 = strAddress2

End Get

Set(ByVal Value As String)

strAddress2 = Value

End Set

End Property

Public Property Address3() As String

Get

Address3 = strAddress3

End Get

Set(ByVal Value As String)

strAddress3 = Value

End Set

End Property

Public Property City() As String

Get

City = strCity

End Get

Set(ByVal Value As String)

strCity = Value

End Set

End Property

Public Property State() As String

Get

State = strState

End Get

Set(ByVal Value As String)

strState = Value

End Set

End Property

Public Property Zip() As String

Get

Zip = strZip

End Get

Set(ByVal Value As String)

strZip = Value

End Set

End Property

Public Property Shipping() As String

Get

Shipping = strShipping

End Get

Set(ByVal Value As String)

strShipping = Value

End Set

End Property

Public Property Email() As String

Get

Email = strEmail

End Get

Set(ByVal Value As String)

strEmail = Value

End Set

End Property

Public Property Phone() As String

Get

Phone = strPhone

End Get

Set(ByVal Value As String)

strPhone = Value

End Set

End Property

Public Property Qty() As String

Get

Qty = strQty

End Get

Set(ByVal Value As String)

strQty = Value

End Set

End Property

Public Property ItemNo() As String

Get

ItemNo = strItemNo

End Get

Set(ByVal Value As String)

strItemNo = Value

End Set

End Property

End Class

Version: Unknown or N/A
Section: eConnect


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3