Java JSoup不翻译html中链接中的符号和
在JSoup中,以下测试用例应该通过,而不是Java JSoup不翻译html中链接中的符号和,java,html-parsing,jsoup,Java,Html Parsing,Jsoup,在JSoup中,以下测试用例应该通过,而不是 @Test public void shouldPrintHrefCorrectly(){ String content= "<li><a href=\"#\">Good</a><ul><li><a href=\"article.php?boid=1865&sid=53&mid=1\">" + "Boss</a><
@Test
public void shouldPrintHrefCorrectly(){
String content= "<li><a href=\"#\">Good</a><ul><li><a href=\"article.php?boid=1865&sid=53&mid=1\">" +
"Boss</a></li><li><a href=\"article.php?boid=186&sid=53&mid=1\">" +
"heavent</a></li><li><a href=\"article.php?boid=167&sid=53&mid=1\">" +
"hellos</a></li><li><a href=\"article.php?boid=181&sid=53&mid=1\">" +
"Mr.Jackson!</a></li>";
Document document = Jsoup.parse(content, "http://www.google.co.in/");
Elements links = document.select("a[href^=article]");
Iterator<Element> iterator = links.iterator();
List<String> urls = new ArrayList<String>();
while(iterator.hasNext()){
urls.add(iterator.next().attr("href"));
}
Assert.assertTrue(urls.contains("article.php?boid=181&sid=53&mid=1"));
}
@测试
公共空白应正确打印(){
字符串内容=“- ”;
Document Document=Jsoup.parse(内容)http://www.google.co.in/");
元素链接=文档。选择(“a[href^=文章]”;
迭代器迭代器=links.Iterator();
列表URL=新的ArrayList();
while(iterator.hasNext()){
add(iterator.next().attr(“href”);
}
Assert.assertTrue(url.contains(“article.php?boid=181&sid=53&mid=1”);
}
有谁能告诉我失败的原因吗?有三个问题:
bovikatanid
参数,而它实际上被称为boid
&
而不是&源代码中的代码>。这在技术上是无效的
&mid
。它应该一直扫描到代码>
更新:看,Jonathan(Jsoup的家伙)已经修好了。它将在下一版本中出现。有三个问题:
bovikatanid
参数,而它实际上被称为boid
&
而不是&源代码中的代码>。这在技术上是无效的
&mid
。它应该一直扫描到代码>
更新:看,Jonathan(Jsoup的家伙)已经修好了。它将在下一版本中出现。对代码进行了出色的审阅。感谢您向JSoup提出问题。愿意和你这样的人一起工作。谢谢巴卢斯。我已经修复了JSoupUnescape问题,它将在下一个版本中提供。对代码进行了出色的审阅。感谢您向JSoup提出问题。愿意和你这样的人一起工作。谢谢巴卢斯。我已经修复了Jsoup unescape问题,它将在下一版本中提供。