public static String xmltest4(String data) { String result; if (!XmlExpresssion.TryParse(data, out result)) { result = data; } return(result); }
/// <summary> /// Assigns the element value to result if the string is xml /// </summary> /// <returns>true if success, false otherwise</returns> public static bool TryParse(string s, out string result) { if (XmlExpresssion.IsXml(s)) { result = regex.Match(s).Result("${data}"); return(true); } else { result = null; return(false); } }
/// <summary> /// Assigns the element value to result if the string is xml /// </summary> /// <returns>true if success, false otherwise</returns> public static bool TryParse(string s, out string result) { if (XmlExpresssion.IsXml(s)) { Regex r = new Regex(XML_PATTERN, RegexOptions.Compiled); result = r.Match(s).Result("${data}"); return(true); } else { result = null; return(false); } }