Question Creating XML from XSD class

bundersuk

New member
Joined
May 20, 2008
Messages
1
Programming Experience
Beginner
hi,

I am new to xml and im trying to create an xml file from information that is inserted into several textboxes on an aspx page. I have generated the vb class file from the xsd using xsd.exe.

I am getting an error tying adding an element to the xml file. The error is "cannot be converted to 1 dimensional array". The element is called <applicants> which has two elements called <applicant> inside it (inase there are two applicants). It has got me stumped. It may be simple for some but im just learning it from examples.

VB.NET:
 Dim oxs As XmlSerializer = New XmlSerializer(GetType(xmlSubmission))


        Dim introducer As New xmlSubmission()
        Dim intstream As StreamWriter
        
        'set properties
        introducer.introducerUser = txtintroducer.Text
        introducer.introducerPass = txtpassword.Text

        introducer.acceleratorCase = New xmlSubmissionAcceleratorCase
        introducer.acceleratorCase.introducer = New xmlSubmissionAcceleratorCaseIntroducer
        introducer.acceleratorCase.introducer.name = txtintname.Text
        introducer.acceleratorCase.introducer.telephone = txtinttel.Text
        introducer.acceleratorCase.introducer.email = txtintemail.Text

        introducer.acceleratorCase.introducer.address = New address
        introducer.acceleratorCase.introducer.address.address1 = txtintadd1.Text
        introducer.acceleratorCase.introducer.address.address2 = txtintadd2.Text
        introducer.acceleratorCase.introducer.address.address3 = txtintadd3.Text
        introducer.acceleratorCase.introducer.address.town = txtinttown.Text
        introducer.acceleratorCase.introducer.address.county = txtintcounty.Text
        introducer.acceleratorCase.introducer.address.postcode = txtintpostcode.Text
        introducer.acceleratorCase.introducer.address.country = txtintcountry.Text

        introducer.acceleratorCase.introducer.agencyNumber = txtintagency.Text

        introducer.acceleratorCase.Item = New xmlSubmissionAcceleratorCaseSecuredLoan
        introducer.acceleratorCase.Item.amount = txtloanamount.Text
        introducer.acceleratorCase.Item.term = txtloanterm.Text
        introducer.acceleratorCase.Item.termNotes = txtloantermnotes.Text
        introducer.acceleratorCase.Item.amountSpecified = txtloanpurpose.Text

        introducer.acceleratorCase.applicants = New xmlSubmissionAcceleratorCaseApplicant - [COLOR="Red"]ERROR HERE[/COLOR]



        intstream = New StreamWriter(Server.MapPath("test.xml"))
        oxs.Serialize(intstream, introducer)
        intstream.Close()

        introducer = Nothing
 
Back
Top