private static async Task<EpubNavigationContent> ReadNavigationContentAsync(XmlReader reader) { EpubNavigationContent result = new EpubNavigationContent(); bool contentFound = await reader.ReadToFollowingAsync("content", "http://www.daisy.org/z3986/2005/ncx/"); while (reader.MoveToNextAttribute()) { switch (reader.LocalName.ToLowerInvariant()) { case "id": result.Id = reader.Value; break; case "src": result.Source = reader.Value; break; } } if (String.IsNullOrWhiteSpace(result.Source)) throw new Exception("Incorrect EPUB navigation content: content source is missing"); reader.MoveToElement(); return result; }
private static EpubNavigationContent ReadNavigationContent(XmlNode navigationContentNode) { EpubNavigationContent result = new EpubNavigationContent(); foreach (XmlAttribute navigationContentNodeAttribute in navigationContentNode.Attributes) { string attributeValue = navigationContentNodeAttribute.Value; switch (navigationContentNodeAttribute.Name.ToLowerInvariant()) { case "id": result.Id = attributeValue; break; case "src": result.Source = attributeValue; break; } } if (String.IsNullOrWhiteSpace(result.Source)) throw new Exception("Incorrect EPUB navigation content: content source is missing"); return result; }