/// <summary>Create a new Node.</summary> /// <param name="baseUri">base URI</param> /// <param name="attributes">attributes (not null, but may be empty)</param> protected internal Node(String baseUri, iText.StyledXmlParser.Jsoup.Nodes.Attributes attributes) { Validate.NotNull(baseUri); Validate.NotNull(attributes); childNodes = EMPTY_NODES; this.baseUri = baseUri.Trim(); this.attributes = attributes; }
// attribute fiddling. create on first access. private void EnsureAttributes() { if (attributes == null) { attributes = new iText.StyledXmlParser.Jsoup.Nodes.Attributes(); attributes.Put(TEXT_KEY, text); } }
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")); }
private INode CreateSvgContainingImage() { iText.StyledXmlParser.Jsoup.Nodes.Element jsoupSVGRoot = new iText.StyledXmlParser.Jsoup.Nodes.Element(iText.StyledXmlParser.Jsoup.Parser.Tag .ValueOf("svg"), ""); iText.StyledXmlParser.Jsoup.Nodes.Attributes attr = new iText.StyledXmlParser.Jsoup.Nodes.Attributes(); attr.Put(SvgConstants.Attributes.XLINK_HREF, "img.png"); iText.StyledXmlParser.Jsoup.Nodes.Element jsoupSVGImage = new iText.StyledXmlParser.Jsoup.Nodes.Element(iText.StyledXmlParser.Jsoup.Parser.Tag .ValueOf("image"), "", attr); INode root = new JsoupElementNode(jsoupSVGRoot); root.AddChild(new JsoupElementNode(jsoupSVGImage)); return(root); }
/// <summary>Default constructor.</summary> /// <remarks>Default constructor. Doesn't setup base uri, children, or attributes; use with caution.</remarks> protected internal Node() { childNodes = EMPTY_NODES; attributes = null; }