Jonathas Sucupira

Jonathas Sucupira

  • NA
  • 166
  • 16.3k

How to add elements to my ArrayList to display in XML format

Jun 14 2011 10:50 AM
Hello,

I am trying to add element name to my web service out.
right now it looks like this.
<anyType xsi:type="xsd:string">Kevin</anyType>
<anyType xsi:type="xsd:string">xxx</anyType>
<anyType xsi:type="xsd:string">PO BOX</anyType>
<anyType xsi:type="xsd:string">San Diego</anyType>

I wanted to customize to look something like this

<Firstname></Firstname>

<Lastname></Lastname>

 <Address></Address>


This is what I got some far.


[WebMethod]

        public ArrayList RetrieveCustomerInfo(string email, string pass, int customerID)

        {

            ArrayList List = new ArrayList();

            PURLDataContext purl = new PURLDataContext();

            var customer = from c in purl.Sel_UserRecipients(email, pass, customerID)

                           select new 

                           {

                               FName = c.FirstName.Trim(),

                               LName = c.LastName.Trim(),

                               Address = c.Address.Trim(),

                               City = c.City.Trim(),

                               StateCode = c.StateCode.Trim(),

                               Zip = c.Zip.Trim(),

                               Email = c.Email.Trim(),

                               Phone = c.Phone.Trim(),

                               CellPhone = c.CellPhone.Trim(),

                               Additional1 = c.Additional1.Trim(),

                               Additional2 = c.Additional2.Trim(),

                               CustomerStatus = c.RecipientStatus.Trim(),

                               SourceCode = c.SourceCode.Trim()

                           };


            foreach (var c in customer)

            {

                FName = c.FName;

                LName = c.LName;

                Address = c.Address;

                City = c.City;

                Email = c.Email;

            }



            List.Add(Address);

            List.Add(City);

            List.Add(StateCode);

            List.Add(Zip);

            List.Add(Email);

            List.Add(Phone);

            return List;

        }


I appreciate any help.


Answers (1)