JSoup.clean() is not preserving relative URLs
问题 I have tried: Whitelist.relaxed(); Whitelist.relaxed().preserveRelativeLinks(true); Whitelist.relaxed().addProtocols("a","href","#","/","http","https","mailto","ftp"); Whitelist.relaxed().addProtocols("a","href","#","/","http","https","mailto","ftp").preserveRelativeLinks(true); None of them work: When I try to clean a relative url, like <a href="/test.xhtml">test</a> I get the href attribute removed ( <a>test</a> ). I am using JSoup 1.8.2. Any ideas? 回答1: The problem most likely stems from