本文整理汇总了Java中org.htmlcleaner.TagNode.addAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java TagNode.addAttribute方法的具体用法?Java TagNode.addAttribute怎么用?Java TagNode.addAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.htmlcleaner.TagNode
的用法示例。
在下文中一共展示了TagNode.addAttribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: downloadObjectLink
import org.htmlcleaner.TagNode; //导入方法依赖的package包/类
final private boolean downloadObjectLink(TagNode node)
throws ClientProtocolException, IllegalStateException, IOException, SearchLibException, URISyntaxException,
ParserConfigurationException, SAXException {
String src = node.getAttributeByName("href");
if (src == null)
return false;
String type = node.getAttributeByName("type");
if (type == null && node.getName().equalsIgnoreCase("script"))
type = "text/javascript";
if (type == null && node.getName().equalsIgnoreCase("link") &&
"stylesheet".equalsIgnoreCase(node.getAttributeByName("rel")))
type = "text/css";
if (type == null)
return false;
src = downloadObject(baseUrl, src, type);
if (src != null)
node.addAttribute("href", src);
return true;
}
示例2: checkStyleAttribute
import org.htmlcleaner.TagNode; //导入方法依赖的package包/类
final private void checkStyleAttribute(TagNode node)
throws ClientProtocolException, IllegalStateException, IOException, SearchLibException, URISyntaxException {
String style = node.getAttributeByName("style");
if (style == null)
return;
if (style.length() == 0)
return;
NaiveCSSParser cssParser = new NaiveCSSParser();
CSSStyleRule cssStyle = cssParser.parseStyleAttribute(style);
if (!handleCssStyle(baseUrl, cssStyle))
return;
node.addAttribute("style", cssStyle.getPropertyString());
}
示例3: downloadObjectIframe
import org.htmlcleaner.TagNode; //导入方法依赖的package包/类
final private boolean downloadObjectIframe(TagNode node, Map<TagNode, WebElement> iframeNodeMap)
throws IllegalStateException, IOException, ParserConfigurationException, SAXException, SearchLibException,
URISyntaxException {
if (!"iframe".equalsIgnoreCase(node.getName()))
return false;
String src = downloadIframe(baseUrl, node, iframeNodeMap);
if (src != null)
node.addAttribute("src", src);
return true;
}
示例4: downloadObjectSrc
import org.htmlcleaner.TagNode; //导入方法依赖的package包/类
final private boolean downloadObjectSrc(TagNode node)
throws ClientProtocolException, IllegalStateException, IOException, SearchLibException, URISyntaxException {
String src = node.getAttributeByName("src");
if (src == null)
return false;
src = downloadObject(baseUrl, src, null);
if (src != null)
node.addAttribute("src", src);
return true;
}