提问人:selvi 提问时间:8/24/2023 最后编辑:0009laHselvi 更新时间:8/24/2023 访问量:50
如何从 guid 中获取此 isPermaLink=“false” 文本?
How to get this isPermaLink="false" text from guid?
问:
如何从guid中获取此文本isPermaLink=“false”?
<guid isPermaLink="false">article-67228311</guid>
我正在使用这个库com.rometools.rome.feed.synd.SyndEntry。有没有办法使用此库在 guid 标记中获取值?下面的 print 语句将值打印为 article-67228311,但我想获取 isPermaLink=“false” 文本。
示例代码:
try (CloseableHttpClient client = HttpClients.createMinimal()) {
HttpUriRequest request = new HttpGet(feedUrl);
try (CloseableHttpResponse response = client.execute(request); InputStream stream = response.getEntity().getContent()) {
SyndFeedInput input = new SyndFeedInput();
SyndFeed feed = input.build(new XmlReader(stream));
Iterator iter = feed.getEntries().iterator();
while (iter.hasNext()) {
SyndEntry syndEntry = (SyndEntry) iter.next();
System.out.println("guid ========" + syndEntry.getUri());
}
}
}
答: 暂无答案
评论