protected XElement ParseSdt(ITagProcessor parentProcessor, XElement sdtElement) { ITagParser parser = null; switch (this.GetTagName(sdtElement).ToLower()) { case "htmlcontent": parser = new HtmlContentParser(); break; case "text": parser = new TextParser(); break; case "table": parser = new TableParser(); break; case "repeater": parser = new RepeaterParser(); break; case "if": parser = new IfParser(); break; } return parser != null ? parser.Parse(parentProcessor, sdtElement) : sdtElement; }
protected XElement ParseSdt(ITagProcessor parentProcessor, XElement sdtElement) { ITagParser parser = null; switch (this.GetTagName(sdtElement).ToLower()) { case "htmlcontent": parser = new HtmlContentParser(); break; case "text": parser = new TextParser(); break; case "table": parser = new TableParser(); break; case "repeater": parser = new RepeaterParser(); break; case "if": parser = new IfParser(); break; } return(parser != null?parser.Parse(parentProcessor, sdtElement) : sdtElement); }
public void TestParse() { using (var docStream = AssemblyResourceHelper.GetResourceStream(this, "HtmlContentParserTest.xml")) { var doc = XDocument.Load(docStream); var processorMock = new TagProcessorMock<HtmlContentProcessor>(); var parser = new HtmlContentParser(); parser.Parse(processorMock, doc.Descendants(WordMl.SdtName).First()); var processor = processorMock.InnerProcessor; var tag = processor.HtmlTag; Assert.IsNotNull(tag); Assert.AreEqual("//test/htmlcontent", tag.Expression); } }