/// <summary> /// Constructs the spell request content XML. /// </summary> /// <param name="text">The text which may contain multiple words.</param> /// <returns></returns> private string ConstructSpellRequestContentXml(string text) { XDocument xdoc = new XDocument( new XElement("spellrequest", new XAttribute(GOOGLE_FLAG_TEXT_ALREAD_CLIPPED, TextAlreadClipped ? "1" : "0"), new XAttribute(GOOGLE_FLAG_IGNORE_DUPS, IgnoreDups ? "1" : "0"), new XAttribute(GOOGLE_FLAG_IGNORE_DIGITS, IgnoreDigits ? "1" : "0"), new XAttribute(GOOGLE_FLAG_IGNORE_ALL_CAPS, IgnoreAllCaps ? "1" : "0"), new XElement("text", String.Join(" ", text))) ) { Declaration = new XDeclaration("1.0", null, null) }; //use the unencoded string writer as google chokes on others var wr = new UnencodedStringWriter(); xdoc.Save(wr); string data = wr.GetStringBuilder().ToString(); return(data); }
/// <summary> /// Constructs the spell request content XML. /// </summary> /// <param name="text">The text which may contain multiple words.</param> /// <returns></returns> private string ConstructSpellRequestContentXml(string text) { XDocument xdoc = new XDocument( new XElement("spellrequest", new XAttribute(GOOGLE_FLAG_TEXT_ALREAD_CLIPPED, TextAlreadClipped ? "1" : "0"), new XAttribute(GOOGLE_FLAG_IGNORE_DUPS, IgnoreDups ? "1" : "0"), new XAttribute(GOOGLE_FLAG_IGNORE_DIGITS, IgnoreDigits ? "1" : "0"), new XAttribute(GOOGLE_FLAG_IGNORE_ALL_CAPS, IgnoreAllCaps ? "1" : "0"), new XElement("text", String.Join(" ",text))) ) { Declaration = new XDeclaration("1.0", null, null) }; //use the unencoded string writer as google chokes on others var wr = new UnencodedStringWriter(); xdoc.Save(wr); string data = wr.GetStringBuilder().ToString(); return data; }