[WebMethod(Description = "GetAddressTest")]
[return: XmlRoot(ElementName = "AddressTest")]
public string GetAddressTest(string memberNbr)
{
XNamespace defaultNamespace = XNamespace.Get("http://tempuri.org/Member.xsd");
XElement addressInfo = new XElement("AddressDetail");
IList<string> addressList = new List<string> { "101 state st", "201 exit st", "301 entrance st" };
var i = 0;
foreach (string item in addressList)
{
i++;
addressInfo.SetElementValue("Address", item[i]);
}
return addressInfo.ToString();
}
here's the output format i want:<?xml version="1.0" encoding="UTF-8"?>
<MemberSpansTest xmlns="http://www.w3.org/2001/XMLSchema-instance">
</MemberSpansTest>
<MemberSpansDetail>
<Address>101 state st</Address>
</MemberSpansDetail>
<MemberSpansDetail>
<Address>201 exit st</Address>
</MemberSpansDetail>
<MemberSpansDetail>
<Address>301 entrance st</Address>
</MemberSpansDetail>
</MemberSpansTest>
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.