コード例 #1
0
 /// <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);
 }
コード例 #2
0
        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));
        }
コード例 #3
0
        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"));
        }