Exemplo n.º 1
0
        public virtual void PreservesRelativeLinksIfConfigured()
        {
            String html  = "<a href='/foo'>Link</a><img src='/bar'> <img src='javascript:alert()'>";
            String clean = iText.StyledXmlParser.Jsoup.Jsoup.Clean(html, "http://example.com/", Whitelist.BasicWithImages
                                                                       ().PreserveRelativeLinks(true));

            NUnit.Framework.Assert.AreEqual("<a href=\"/foo\" rel=\"nofollow\">Link</a>\n<img src=\"/bar\"> \n<img>",
                                            clean);
        }
Exemplo n.º 2
0
        public virtual void ResolvesRelativeLinks()
        {
            String html  = "<a href='/foo'>Link</a><img src='/bar'>";
            String clean = iText.StyledXmlParser.Jsoup.Jsoup.Clean(html, "http://example.com/", Whitelist.BasicWithImages
                                                                       ());

            NUnit.Framework.Assert.AreEqual("<a href=\"http://example.com/foo\" rel=\"nofollow\">Link</a>\n<img src=\"http://example.com/bar\">"
                                            , clean);
        }