/// <summary> /// Creates a new /// <see cref="JsoupElementNode"/> /// instance. /// </summary> /// <param name="element">the element</param> public JsoupElementNode(iText.StyledXmlParser.Jsoup.Nodes.Element element) : base(element) { this.element = element; this.attributes = new JsoupAttributes(element.Attributes()); this.lang = GetAttribute(CommonAttributeConstants.LANG); }
public virtual void OverrideDefaultStyleTest() { ICssResolver styleResolver = new SvgStyleResolver(); iText.StyledXmlParser.Jsoup.Nodes.Element svg = new iText.StyledXmlParser.Jsoup.Nodes.Element(iText.StyledXmlParser.Jsoup.Parser.Tag .ValueOf("svg"), ""); svg.Attributes().Put(SvgConstants.Attributes.STROKE, "white"); INode svgNode = new JsoupElementNode(svg); IDictionary <String, String> resolvedStyles = styleResolver.ResolveStyles(svgNode, null); NUnit.Framework.Assert.AreEqual("white", resolvedStyles.Get(SvgConstants.Attributes.STROKE)); }
public virtual void SvgCssResolveMalformedXlinkTest() { iText.StyledXmlParser.Jsoup.Nodes.Element jsoupImage = new iText.StyledXmlParser.Jsoup.Nodes.Element(iText.StyledXmlParser.Jsoup.Parser.Tag .ValueOf("image"), ""); iText.StyledXmlParser.Jsoup.Nodes.Attributes imageAttributes = jsoupImage.Attributes(); imageAttributes.Put(new iText.StyledXmlParser.Jsoup.Nodes.Attribute("xlink:href", "htt://are/")); JsoupElementNode node = new JsoupElementNode(jsoupImage); SvgStyleResolver sr = new SvgStyleResolver(); IDictionary <String, String> attr = sr.ResolveStyles(node, new SvgCssContext()); NUnit.Framework.Assert.AreEqual("htt://are/", attr.Get("xlink:href")); }