XmlDocument doc = new XmlDocument();
doc.LoadXml(template);
XmlElement list = doc.CreateElement(conn.XmlListTagName);
foreach (EaiItem updateItem in itemList)
{
XmlElement item = doc.CreateElement( conn.XmlItemTagName );
foreach(String itemAttrib in updateItem.ItemAttributes.Keys)
{
item.SetAttribute(itemAttrib, updateItem.ItemAttributes[itemAttrib]);
}
item.InnerXml = updateItem.ItemFieldXml;
list.AppendChild(item);
}
doc.LastChild.AppendChild(list);
Fortify tool displaying the xml injection in the below code
item.InnerXml = updateItem.ItemFieldXml;
How to prevent the xml injection issue ?
ItemFieldXmlcontains XML that you want to insert into your document as a child XML fragment of youritemelement? or do you want it stored asCDATA?