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

UpdateVariablesAndDataDiv() private method

Create or update the data div with all the data-book values in the document
private UpdateVariablesAndDataDiv ( XmlNode elementToReadFrom, BookInfo info = null ) : void
elementToReadFrom System.Xml.XmlNode This is either the whole document, or a page div that we just edited and want to read from.
info BookInfo
return void
        private void UpdateVariablesAndDataDiv(XmlNode elementToReadFrom, BookInfo info = null)
        {
            //Debug.WriteLine("before update: " + _dataDiv.OuterXml);

            var itemsToDelete = new HashSet<Tuple<string, string>>();
            DataSet incomingData = SynchronizeDataItemsFromContentsOfElement(elementToReadFrom, itemsToDelete);
            incomingData.UpdateGenericLanguageString("contentLanguage1", _collectionSettings.Language1Iso639Code, false);
            incomingData.UpdateGenericLanguageString("contentLanguage2",
                                             String.IsNullOrEmpty(MultilingualContentLanguage2)
                                                 ? null
                                                 : MultilingualContentLanguage2, false);
            incomingData.UpdateGenericLanguageString("contentLanguage3",
                                             String.IsNullOrEmpty(MultilingualContentLanguage3)
                                                 ? null
                                                 : MultilingualContentLanguage3, false);

            //Debug.WriteLine("xyz: " + _dataDiv.OuterXml);
            foreach (var v in incomingData.TextVariables)
            {
                if (!v.Value.IsCollectionValue)
                    UpdateSingleTextVariableInDataDiv(v.Key,v.Value.TextAlternatives);
            }
            foreach (var tuple in itemsToDelete)
                UpdateSingleTextVariableInDataDiv(tuple.Item1, tuple.Item2, "");
            //Debug.WriteLine("after update: " + _dataDiv.OuterXml);

            UpdateTitle(info);//this may change our "bookTitle" variable if the title is based on a template that reads other variables (e.g. "Primer Term2-Week3")
            UpdateIsbn(info);
            if (info != null)
                UpdateBookInfoTags(info);
            UpdateCredits(info);
        }