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

GetMetaValue() public method

public GetMetaValue ( string name, string defaultValue ) : string
name string
defaultValue string
return string
        public string GetMetaValue(string name, string defaultValue)
        {
            var node = _dom.SafeSelectNodes("//head/meta[@name='" + name + "' or @name='" + name.ToLowerInvariant() + "']");
            if(node.Count > 0)
            {
                return ((XmlElement) node[0]).GetAttribute("content");
            }
            return defaultValue;
        }

Usage Example

        /// <summary>
        /// we update these so that the file continues to look the same when you just open it in firefox
        /// </summary>
        private void UpdateSupportFiles()
        {
            if (IsPathReadonly(_folderPath))
            {
                Logger.WriteEvent("Not updating files in folder {0} because the directory is read-only.", _folderPath);
            }
            else
            {
                UpdateIfNewer("placeHolder.png");
                UpdateIfNewer("basePage.css");
                UpdateIfNewer("previewMode.css");
                UpdateIfNewer("origami.css");

                foreach (var path in Directory.GetFiles(_folderPath, "*.css"))
                {
                    var file = Path.GetFileName(path);
                    //if (file.ToLower().Contains("portrait") || file.ToLower().Contains("landscape"))
                    UpdateIfNewer(file);
                }
            }

            //by default, this comes from the collection, but the book can select one, inlucing "null" to select the factory-supplied empty xmatter
            var nameOfXMatterPack = _dom.GetMetaValue("xMatter", _collectionSettings.XMatterPackName);
            var helper            = new XMatterHelper(_dom, nameOfXMatterPack, _fileLocator);

            UpdateIfNewer(Path.GetFileName(helper.PathToStyleSheetForPaperAndOrientation), helper.PathToStyleSheetForPaperAndOrientation);
        }
All Usage Examples Of Bloom.Book.HtmlDom::GetMetaValue