Bloom.Book.BookData.UpdateVariablesAndDataDivThroughDOM C# (CSharp) Method

UpdateVariablesAndDataDivThroughDOM() public method

public UpdateVariablesAndDataDivThroughDOM ( BookInfo info = null ) : void
info BookInfo
return void
        public void UpdateVariablesAndDataDivThroughDOM(BookInfo info = null)
        {
            UpdateVariablesAndDataDiv(_dom.RawDom.FirstChild, info);
        }

Usage Example

Example #1
0
        public void UpdateVariablesAndDataDivThroughDOM_NewLangAdded_AddedToDataDiv()
        {
            var dom = new HtmlDom(@"<html><head></head><body><div data-book='someVariable' lang='en'>hi</div></body></html>");

            var e = dom.RawDom.CreateElement("div");
            e.SetAttribute("data-book", "someVariable");
            e.SetAttribute("lang", "fr");
            e.InnerText = "bonjour";
            dom.RawDom.SelectSingleNode("//body").AppendChild(e);
            var data = new BookData(dom,   new CollectionSettings(), null);
            data.UpdateVariablesAndDataDivThroughDOM();
            AssertThatXmlIn.Dom(dom.RawDom).HasSpecifiedNumberOfMatchesForXpath("//body/div[1][@id='bloomDataDiv']", 1);//NB microsoft uses 1 as the first. W3c uses 0.
            AssertThatXmlIn.Dom(dom.RawDom).HasSpecifiedNumberOfMatchesForXpath("//div[@id='bloomDataDiv']/div[@data-book='someVariable' and @lang='en' and text()='hi']", 1);
            AssertThatXmlIn.Dom(dom.RawDom).HasSpecifiedNumberOfMatchesForXpath("//div[@id='bloomDataDiv']/div[@data-book='someVariable' and @lang='fr' and text()='bonjour']", 1);
        }
All Usage Examples Of Bloom.Book.BookData::UpdateVariablesAndDataDivThroughDOM