Bloom.Book.HtmlDom.ValidateBook C# (CSharp) Method

ValidateBook() public method

public ValidateBook ( string descriptionOfBookForErrorLog ) : string
descriptionOfBookForErrorLog string
return string
        public string ValidateBook(string descriptionOfBookForErrorLog)
        {
            var ids = new List<string>();
            var builder = new StringBuilder();

            Ensure(RawDom.SafeSelectNodes("//div[contains(@class,'bloom-page')]").Count > 0, "Must have at least one page",
                builder);
            EnsureIdsAreUnique(this, "textarea", ids, builder);
            EnsureIdsAreUnique(this, "p", ids, builder);
            EnsureIdsAreUnique(this, "img", ids, builder);

            //TODO: validate other things, including html
            var x = builder.ToString().Trim();
            if(x.Length == 0)
                Logger.WriteEvent("HtmlDom.ValidateBook({0}): No Errors", descriptionOfBookForErrorLog);
            else
            {
                Logger.WriteEvent("HtmlDom.ValidateBook({0}): {1}", descriptionOfBookForErrorLog, x);
            }

            return builder.ToString();
        }

Usage Example

Example #1
0
        public static string ValidateBook(string path)
        {
            Debug.WriteLine(string.Format("ValidateBook({0})", path));
            var dom = new HtmlDom(XmlHtmlConverter.GetXmlDomFromHtmlFile(path, false));            //with throw if there are errors

            return(dom.ValidateBook(path));
        }
All Usage Examples Of Bloom.Book.HtmlDom::ValidateBook