//For each term in the text, replace the FieldID (if found) with the FieldName
 public static string EmbedFieldNames(ComplexList complexList, string sText)
 {
     //match anything of the form <img...src="TextImage.ashx?text="...".../> in _text
     if (!string.IsNullOrEmpty(sText))
     {
         MatchCollection matches = Regex.Matches(sText, XMLNames._M_FieldImageTemplate);
         foreach (Match match in matches)
         {
             string sFieldName = match.Groups[1].Value;
             ComplexListField field = null;
             if (IsEmbeddedID(sFieldName))
             {
                 field = complexList.FindField(new Guid(FilterEmbeddedID(sFieldName)));
                 if (field != null)
                 {
                     //Replace <img ... > with field value
                     string matchedText = match.Value;
                     string replacementText = "";
                     replacementText = matchedText.Replace(sFieldName, field.Name);
                     sText = sText.Replace(matchedText, replacementText);
                 }
             }
         }
     }
     return sText;
 }
        public ComplexListItemValue(XmlNode node, ComplexList complexList)
		{
            _complexList = complexList;

            try
            {
                string fieldID = Utility.XMLHelper.GetAttributeString(node, XMLNames._A_FieldID);
                _fieldID = new Guid(fieldID);
                _fieldIDDefined = true;
            }
            catch
            {
                _fieldIDDefined = false;
                try
                {
                    _fieldName = Utility.XMLHelper.GetAttributeString(node, XMLNames._A_FieldName);
                }
                catch
                {
                }
            }

            _fieldFilterTerm = complexList.FindField(_fieldID).FilterTerm;
            _bigText = Utility.XMLHelper.GetAttributeBool(node, XMLNames._A_BigText) ?? false;
            _fieldValue = Utility.XMLHelper.GetText(node);
            _removeBlank = Utility.XMLHelper.GetAttributeBool(node, XMLNames._A_RemoveBlank) ?? false;
		}
 //For each term in the text, replace the FieldName (if found) with the FieldID
 public static string EmbedFieldIDs(ComplexList complexList, string sText)
 {
     //match anything of the form <img...src="TextImage.ashx?text="...".../> in _text
     if (!string.IsNullOrEmpty(sText))
     {
         MatchCollection matches = Regex.Matches(sText, XMLNames._M_FieldImageTemplate);
         foreach (Match match in matches)
         {
             string fieldName = match.Groups[1].Value;
             ComplexListField field = null;
             string sFieldName = fieldName.Replace("&quot;", "\"");
             if (!IsEmbeddedID(sFieldName))
             {
                 field = complexList.FindField(sFieldName);
                 if (field != null)
                 {
                     //Replace <img ... > with term value
                     string matchedText = match.Value;
                     string replacementText = "";
                     replacementText = matchedText.Replace(fieldName, field.EmbeddedID);
                     sText = sText.Replace(matchedText, replacementText);
                 }
                 else
                     //Need to check for 'reserved term names'
                     if (!sFieldName.StartsWith("*"))
                         throw new Exception(string.Format("Unable to locate term named '{0}' when substituting terms", sFieldName));
             }
         }
     }
     return sText;
 }