本文整理了Java中org.dom4j.Element.attributes()
方法的一些代码示例,展示了Element.attributes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.attributes()
方法的具体详情如下:
包路径:org.dom4j.Element
类名称:Element
方法名:attributes
[英]Returns the Attributeinstances this element contains as a backed Listso that the attributes may be modified directly using the Listinterface. The List
is backed by the Element
so that changes to the list are reflected in the element and vice versa.
[中]返回此元素作为备份列表包含的AttributeInstance,以便可以使用Listinterface直接修改属性。List
由Element
支持,因此对列表的更改会反映在元素中,反之亦然。
代码示例来源:origin: Tencent/tinker
private void copyAttributes(Element srcNode, Element destNode) {
for (Object attrObj : srcNode.attributes()) {
final Attribute attr = (Attribute) attrObj;
destNode.addAttribute(attr.getQName(), attr.getValue());
}
}
代码示例来源:origin: jaxen/jaxen
declaredNS.add(context.getNamespace());
for ( Iterator iter = context.attributes().iterator(); iter.hasNext(); )
代码示例来源:origin: org.freemarker/freemarker
Element e = (Element) node;
if (localName == null) {
result.addAll(e.attributes());
} else {
Attribute attr = e.attribute(e.getQName().getDocumentFactory().createQName(localName, "", namespaceUri));
代码示例来源:origin: igniterealtime/Openfire
added.setText(child.getText());
for (Attribute attr : (List<Attribute>)child.attributes()) {
added.addAttribute(attr.getQName(), attr.getValue());
代码示例来源:origin: pentaho/pentaho-kettle
Element e = (Element) node;
List<Attribute> lista = e.attributes();
for ( int i = 0; i < lista.size(); i++ ) {
setAttributeField( lista.get( i ), monitor );
代码示例来源:origin: mrdear/JavaWEB
System.out.println("当前节点的名称::" + node.getName());
List<Attribute> attributes = node.attributes();
for (Attribute tempAttr : attributes) {
System.out.println("当前节点的属性名称:" + tempAttr.getValue());
代码示例来源:origin: webx/citrus
for (Iterator<?> i = element.attributes().iterator(); i.hasNext(); ) {
Attribute attr = (Attribute) i.next();
代码示例来源:origin: webx/citrus
for (Iterator<?> i = element.attributes().iterator(); i.hasNext(); ) {
Attribute attr = (Attribute) i.next();
代码示例来源:origin: webx/citrus
for (Iterator<?> i = element.attributes().iterator(); i.hasNext(); ) {
Attribute attr = (Attribute) i.next();
代码示例来源:origin: webx/citrus
for (Object attr : dom4jElement.attributes()) {
String name = ((Attribute) attr).getQualifiedName();
String value = ((Attribute) attr).getValue();
代码示例来源:origin: org.dom4j/dom4j
for (Attribute attribute : element.attributes()) {
String attUri = attribute.getNamespaceURI();
String attName = attribute.getQualifiedName();
代码示例来源:origin: webx/citrus
for (Object attr : dom4jElement.attributes()) {
String name = ((Attribute) attr).getQualifiedName();
String value = ((Attribute) attr).getValue();
代码示例来源:origin: com.haulmont.cuba/cuba-global
/**
* @deprecated Use Dom4j API.
*/
@Deprecated
public static List<Attribute> attributes(Element element) {
return element.attributes();
}
代码示例来源:origin: com.haulmont.cuba/cuba-global
public static void walkAttributes(Element element, ElementAttributeVisitor visitor) {
for (Attribute attribute : element.attributes()) {
visitor.onVisit(element, attribute);
}
}
代码示例来源:origin: stackoverflow.com
String url = "http://stackoverflow.com/questions/7311269"
+ "/java-print-any-detail-of-html-element";
Document doc = Jsoup.connect(url).get();
Elements divs = doc.select("div");
int i = 0;
for (Element div : divs) {
System.out.format("Div #%d:\n", ++i);
for(Attribute attr : div.attributes()) {
System.out.format("%s = %s\n", attr.getKey(), attr.getValue());
}
}
代码示例来源:origin: stackoverflow.com
HashSet<String> allTags=new HashSet<String>();
Document doc=Jsoup.connect("http://seenyc.co/").get();
Elements elements=doc.getAllElements();
for(Element ele:elements){
String s=ele.tagName();
Attributes n=ele.attributes();
allTags.add(s);
}
// here your hashset will have all distinct tag names from website
代码示例来源:origin: stackoverflow.com
Document doc = Jsoup.parse(html_contents);
for (Element element : doc.getAllElements())
{
for (Attribute attribute : element.attributes())
{
if(attribute.getKey().equalsIgnoreCase("alt"))
{
names.add(attribute.getValue());
}
}
}
代码示例来源:origin: com.tencent.tinker/tinker-patch-lib
private void copyAttributes(Element srcNode, Element destNode) {
for (Object attrObj : srcNode.attributes()) {
final Attribute attr = (Attribute) attrObj;
destNode.addAttribute(attr.getQName(), attr.getValue());
}
}
代码示例来源:origin: stackoverflow.com
Document doc = Jsoup.parseBodyFragment(aText);
Elements el = doc.getAllElements();
for (Element e : el) {
Attributes at = e.attributes();
for (Attribute a : at) {
e.removeAttr(a.getKey());
}
}
if(Jsoup.isValid(doc.body().html(), theLegalWhitelist))
return true;
else
return false;
代码示例来源:origin: dom4j/dom4j
protected void testParentRelationship(Element element) {
testParentRelationship(element, element.attributes());
testParentRelationship(element, element.content());
}
内容来源于网络,如有侵权,请联系作者删除!