コード例 #1
0
ファイル: NavigationReader.cs プロジェクト: tonley/EpubReader
        private static EpubNavigationDocTitle ReadNavigationDocTitle(XElement docTitleNode)
        {
            EpubNavigationDocTitle result = new EpubNavigationDocTitle();

            foreach (XElement textNode in docTitleNode.Elements())
            {
                if (String.Compare(textNode.Name.LocalName, "text", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    result.Add(textNode.Value);
                }
            }
            return(result);
        }
コード例 #2
0
        private static EpubNavigationDocTitle ReadNavigationDocTitle(XmlNode docTitleNode)
        {
            EpubNavigationDocTitle result = new EpubNavigationDocTitle();

            foreach (XmlNode textNode in docTitleNode.ChildNodes)
            {
                if (String.Compare(textNode.LocalName, "text", StringComparison.OrdinalIgnoreCase) == 0)
                {
                    result.Add(textNode.InnerText);
                }
            }
            return(result);
        }
コード例 #3
0
        private static async Task <EpubNavigationDocTitle> ReadNavigationDocTitleAsync(XmlReader reader)
        {
            EpubNavigationDocTitle result = new EpubNavigationDocTitle();
            bool titleFound = await reader.ReadToFollowingAsync("docTitle", "http://www.daisy.org/z3986/2005/ncx/");

            if (!titleFound)
            {
                throw new Exception("EPUB parsing error: title section not found in the .toc file.");
            }
            while (await reader.ReadAsync() && !(reader.NodeType == XmlNodeType.EndElement && reader.LocalName == "docTitle"))
            {
                if (reader.LocalName.ToLowerInvariant() == "text")
                {
                    result.Add(reader.ReadElementContentAsString());
                }
            }
            return(result);
        }
コード例 #4
0
        private static async Task<EpubNavigationDocTitle> ReadNavigationDocTitleAsync(XmlReader reader)
        {
            EpubNavigationDocTitle result = new EpubNavigationDocTitle();
            bool titleFound = await reader.ReadToFollowingAsync("docTitle", "http://www.daisy.org/z3986/2005/ncx/");

            if (!titleFound)
                throw new Exception("EPUB parsing error: title section not found in the .toc file.");
            while (await reader.ReadAsync() && !(reader.NodeType == XmlNodeType.EndElement && reader.LocalName == "docTitle"))
            {
                if (reader.LocalName.ToLowerInvariant() == "text")
                {
                    result.Add(reader.ReadElementContentAsString());
                }
            }
            return result;
        }
コード例 #5
0
ファイル: NavigationReader.cs プロジェクト: gareiz/EpubReader
 private static EpubNavigationDocTitle ReadNavigationDocTitle(XmlNode docTitleNode)
 {
     EpubNavigationDocTitle result = new EpubNavigationDocTitle();
     foreach (XmlNode textNode in docTitleNode.ChildNodes)
         if (String.Compare(textNode.LocalName, "text", StringComparison.OrdinalIgnoreCase) == 0)
             result.Add(textNode.InnerText);
     return result;
 }