public IHTMLItem Convert(SubTitleItem subtitleItem, SubtitleConverterParamsV2 subtitleConverterParams) { if (subtitleItem == null) { throw new ArgumentNullException("subtitleItem"); } //Div subtitle = new Div(); var paragraphConverter = new ParagraphConverterV2(); var internalData = paragraphConverter.Convert(subtitleItem, new ParagraphConverterParamsV2 { ResultType = ParagraphConvTargetEnumV2.Paragraph, Settings = subtitleConverterParams.Settings, StartSection = false }); SetClassType(internalData, ElementStylesV2.PoemSubTitle); //subtitle.Add(internalData); //SetClassType(subtitle); //return subtitle; return(internalData); }
internal void Load(XElement xPoem) { if (xPoem == null) { throw new ArgumentNullException("xPoem"); } if (xPoem.Name.LocalName != Fb2PoemElementName) { throw new ArgumentException("Element of wrong type passed", "xPoem"); } Title = null; Date = null; epigraphs.Clear(); content.Clear(); authors.Clear(); IEnumerable<XElement> xElements = xPoem.Elements(); foreach (var xElement in xElements) { if (xElement.Name == (XName)(xPoem.Name.Namespace + StanzaItem.Fb2StanzaElementName)) { StanzaItem stanza = new StanzaItem(); try { stanza.Load(xElement); content.Add(stanza); } catch (Exception) { continue; } } else if (xElement.Name == (XName)(xPoem.Name.Namespace + SubTitleItem.Fb2SubtitleElementName)) { SubTitleItem subtitle = new SubTitleItem(); try { subtitle.Load(xElement); content.Add(subtitle); } catch (Exception) { continue; } } else if (xElement.Name == (XName)(xPoem.Name.Namespace + TitleItem.Fb2TitleElementName) && Title == null) // only one title { Title = new TitleItem(); Title.Load(xElement); } else if (xElement.Name == (XName)(xPoem.Name.Namespace + EpigraphItem.Fb2EpigraphElementName)) { EpigraphItem epigraphItem = new EpigraphItem(); try { epigraphItem.Load(xElement); epigraphs.Add(epigraphItem); } catch (Exception) { continue; } } else if (xElement.Name == (XName)(xPoem.Name.Namespace + TextAuthorItem.Fb2TextAuthorElementName)) { TextAuthorItem author = new TextAuthorItem(); try { author.Load(xElement); authors.Add(author); } catch (Exception) { continue; } } else if (xElement.Name == (XName)(xPoem.Name.Namespace + DateItem.Fb2DateElementName) && Date == null) // only one date { Date = new DateItem(); try { Date.Load(xElement); } catch (Exception) { continue; } } } XAttribute xID = xPoem.Attribute("id"); if ((xID != null) && (xID.Value != null)) { ID = xID.Value; } Lang = null; XAttribute xLang = xPoem.Attribute(XNamespace.Xml + "lang"); if ((xLang != null) && (xLang.Value != null)) { Lang = xLang.Value; } }
internal void Load(XElement xStanza) { if (xStanza == null) { throw new ArgumentNullException(nameof(xStanza)); } if (xStanza.Name.LocalName != Fb2StanzaElementName) { throw new ArgumentException("Element of wrong type passed", nameof(xStanza)); } Title = null; XElement xTitle = xStanza.Element(xStanza.Name.Namespace + TitleItem.Fb2TitleElementName); if (xTitle != null) { Title = new TitleItem(); try { Title.Load(xTitle); } catch (Exception) { // ignored } } SubTitle = null; XElement xSubtitle = xStanza.Element(xStanza.Name.Namespace + SubTitleItem.Fb2SubtitleElementName); if (xSubtitle != null) { SubTitle = new SubTitleItem(); try { SubTitle.Load(xSubtitle); } catch (Exception) { // ignored } } _lines.Clear(); IEnumerable <XElement> xLines = xStanza.Elements(xStanza.Name.Namespace + VPoemParagraph.Fb2VParagraphItemName); foreach (var xLine in xLines) { VPoemParagraph vline = new VPoemParagraph(); try { vline.Load(xLine); _lines.Add(vline); } catch (Exception) { // ignored } } Lang = null; XAttribute xLang = xStanza.Attribute(XNamespace.Xml + "lang"); if (xLang != null && xLang.Value != null) { Lang = xLang.Value; } }
internal void Load(XElement xPoem) { if (xPoem == null) { throw new ArgumentNullException("xPoem"); } if (xPoem.Name.LocalName != Fb2PoemElementName) { throw new ArgumentException("Element of wrong type passed", "xPoem"); } Title = null; Date = null; epigraphs.Clear(); content.Clear(); authors.Clear(); IEnumerable <XElement> xElements = xPoem.Elements(); foreach (var xElement in xElements) { if (xElement.Name == (XName)(xPoem.Name.Namespace + StanzaItem.Fb2StanzaElementName)) { StanzaItem stanza = new StanzaItem(); try { stanza.Load(xElement); content.Add(stanza); } catch (Exception) { continue; } } else if (xElement.Name == (XName)(xPoem.Name.Namespace + SubTitleItem.Fb2SubtitleElementName)) { SubTitleItem subtitle = new SubTitleItem(); try { subtitle.Load(xElement); content.Add(subtitle); } catch (Exception) { continue; } } else if (xElement.Name == (XName)(xPoem.Name.Namespace + TitleItem.Fb2TitleElementName) && Title == null) // only one title { Title = new TitleItem(); Title.Load(xElement); } else if (xElement.Name == (XName)(xPoem.Name.Namespace + EpigraphItem.Fb2EpigraphElementName)) { EpigraphItem epigraphItem = new EpigraphItem(); try { epigraphItem.Load(xElement); epigraphs.Add(epigraphItem); } catch (Exception) { continue; } } else if (xElement.Name == (XName)(xPoem.Name.Namespace + TextAuthorItem.Fb2TextAuthorElementName)) { TextAuthorItem author = new TextAuthorItem(); try { author.Load(xElement); authors.Add(author); } catch (Exception) { continue; } } else if (xElement.Name == (XName)(xPoem.Name.Namespace + DateItem.Fb2DateElementName) && Date == null) // only one date { Date = new DateItem(); try { Date.Load(xElement); } catch (Exception) { continue; } } } XAttribute xID = xPoem.Attribute("id"); if ((xID != null) && (xID.Value != null)) { ID = xID.Value; } Lang = null; XAttribute xLang = xPoem.Attribute(XNamespace.Xml + "lang"); if ((xLang != null) && (xLang.Value != null)) { Lang = xLang.Value; } }
internal void Load(XElement xStanza) { if (xStanza == null) { throw new ArgumentNullException("xStanza"); } if (xStanza.Name.LocalName != Fb2StanzaElementName) { throw new ArgumentException("Element of wrong type passed", "xStanza"); } Title = null; XElement xTitle = xStanza.Element(xStanza.Name.Namespace + TitleItem.Fb2TitleElementName); if (xTitle != null) { Title = new TitleItem(); try { Title.Load(xTitle); } catch (Exception) { } } SubTitle = null; XElement xSubtitle = xStanza.Element(xStanza.Name.Namespace + SubTitleItem.Fb2SubtitleElementName); if (xSubtitle != null) { SubTitle = new SubTitleItem(); try { SubTitle.Load(xSubtitle); } catch (Exception) { } } lines.Clear(); IEnumerable<XElement> xLines = xStanza.Elements(xStanza.Name.Namespace + VPoemParagraph.Fb2VParagraphItemName); foreach (var xLine in xLines) { VPoemParagraph vline = new VPoemParagraph(); try { vline.Load(xLine); lines.Add(vline); } catch (Exception) { continue; } } Lang = null; XAttribute xLang = xStanza.Attribute(XNamespace.Xml + "lang"); if ((xLang != null) && (xLang.Value != null)) { Lang = xLang.Value; } }