1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| StringBuilder strXML = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
strXML.Append("<selectChoice>");
strXML.Append("<selectElement>");
strXML.Append("<formName>"+strForm+"</formName>");
strXML.Append("<formElem>" + strElem + "</formElem>");
strXML.Append("</selectElement>");
if (listExperts.Length > 0)
{
strXML.Append("<entry>");
strXML.Append("<optionText>Choisissez un expert</optionText>");
strXML.Append("<optionValue>-1</optionValue>");
strXML.Append("</entry>");
foreach (SCollaborateur c in listExperts) //Mon objet collaborateur
{
strXML.Append("<entry>");
strXML.Append("<optionText>" + c.FullName + "</optionText>");
strXML.Append("<optionValue>" + c.Id + "</optionValue>");
strXML.Append("</entry>");
}
}
else
{
strXML.Append("<entry>");
strXML.Append("<optionText>Il y a pas experts</optionText>");
strXML.Append("<optionValue>-1</optionValue>");
strXML.Append("</entry>");
}
strXML.Append("</selectChoice>");
Response.AddHeader("Content-Type","text/xml");
Response.Write(strXML.ToString()); |