本文整理了Java中org.dom4j.Attribute.getQName()
方法的一些代码示例,展示了Attribute.getQName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute.getQName()
方法的具体详情如下:
包路径:org.dom4j.Attribute
类名称:Attribute
方法名:getQName
[英]Returns the QName
of this attribute which represents the local name, the qualified name and the Namespace
.
[中]返回此属性的QName
,该属性表示本地名称、限定名称和Namespace
。
代码示例来源: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: igniterealtime/Openfire
added.addAttribute(attr.getQName(), attr.getValue());
代码示例来源:origin: org.dom4j/dom4j
public Attribute attribute(QName qName) {
final Object attributesShadow = this.attributes;
if (attributesShadow instanceof List) {
List<Attribute> list = (List<Attribute>) attributesShadow;
for (Attribute attribute : list) {
if (qName.equals(attribute.getQName())) {
return attribute;
}
}
} else if (attributesShadow != null) {
Attribute attribute = (Attribute) attributesShadow;
if (qName.equals(attribute.getQName())) {
return attribute;
}
}
return null;
}
代码示例来源:origin: org.dom4j/dom4j
public int compare(Attribute n1, Attribute n2) {
int answer = compare(n1.getQName(), n2.getQName());
if (answer == 0) {
answer = compare(n1.getValue(), n2.getValue());
}
return answer;
}
代码示例来源:origin: org.dom4j/dom4j
Attribute copy = attribute(attribute.getQName());
if (attribute.getQName().equals(other.getQName())) {
attributes = null;
代码示例来源:origin: org.dom4j/dom4j
public Attribute attribute(QName qName) {
for (Attribute attribute : attributeList()) {
if (qName.equals(attribute.getQName())) {
return attribute;
}
}
return null;
}
代码示例来源:origin: org.dom4j/dom4j
public boolean remove(Attribute attribute) {
List<Attribute> list = attributeList();
boolean answer = list.remove(attribute);
if (answer) {
childRemoved(attribute);
} else {
// we may have a copy of the attribute
Attribute copy = attribute(attribute.getQName());
if (copy != null) {
list.remove(copy);
answer = true;
}
}
return answer;
}
代码示例来源:origin: org.dom4j/dom4j
public javax.xml.stream.events.Attribute next() {
Attribute attr = iter.next();
QName attrName = createQName(attr.getQName());
String value = attr.getValue();
return factory.createAttribute(attrName, value);
}
代码示例来源:origin: org.dom4j/dom4j
protected void removeFromAttributeIndex(Attribute attribute) {
QName qName = attribute.getQName();
String name = qName.getName();
removeFromAttributeIndex(qName, attribute);
removeFromAttributeIndex(name, attribute);
}
代码示例来源:origin: org.dom4j/dom4j
protected void addToAttributeIndex(Attribute attribute) {
QName qName = attribute.getQName();
String name = qName.getName();
addToAttributeIndex(qName, attribute);
addToAttributeIndex(name, attribute);
}
代码示例来源:origin: org.dom4j/dom4j
/**
* Constructs a STAX {@link javax.xml.stream.events.Attribute}event from a
* DOM4J {@link Attribute}.
*
* @param attr
* The {@link Attribute}from which to construct the event.
*
* @return The newly constructed {@link javax.xml.stream.events.Attribute}
* event.
*/
public javax.xml.stream.events.Attribute createAttribute(Attribute attr) {
QName attrName = createQName(attr.getQName());
String value = attr.getValue();
return factory.createAttribute(attrName, value);
}
代码示例来源:origin: org.dom4j/dom4j
public void appendAttributes(Element element) {
for (int i = 0, size = element.attributeCount(); i < size; i++) {
Attribute attribute = element.attribute(i);
if (attribute.supportsParent()) {
addAttribute(attribute.getQName(), attribute.getValue());
} else {
add(attribute);
}
}
}
代码示例来源:origin: org.dom4j/dom4j
public void add(Attribute attribute) {
if (attribute.getParent() != null) {
String message = "The Attribute already has an existing parent \""
+ attribute.getParent().getQualifiedName() + "\"";
throw new IllegalAddException(this, attribute, message);
}
if (attribute.getValue() == null) {
// try remove a previous attribute with the same
// name since adding an attribute with a null value
// is equivalent to removing it.
Attribute oldAttribute = attribute(attribute.getQName());
if (oldAttribute != null) {
remove(oldAttribute);
}
} else {
attributeList().add(attribute);
childAdded(attribute);
}
}
代码示例来源:origin: org.dom4j/dom4j
public void add(Attribute attribute) {
if (attribute.getParent() != null) {
String message = "The Attribute already has an existing parent \""
+ attribute.getParent().getQualifiedName() + "\"";
throw new IllegalAddException(this, attribute, message);
}
if (attribute.getValue() == null) {
// try remove a previous attribute with the same
// name since adding an attribute with a null value
// is equivalent to removing it.
Attribute oldAttribute = attribute(attribute.getQName());
if (oldAttribute != null) {
remove(oldAttribute);
}
} else {
if (attributes == null) {
attributes = attribute;
} else {
attributeList().add(attribute);
}
childAdded(attribute);
}
}
代码示例来源:origin: webx/citrus
Attribute attr = (Attribute) i.next();
if (schemaLocationQName.equals(attr.getQName())) {
schemaLocation = attr.getText();
} else {
代码示例来源:origin: webx/citrus
Attribute attr = (Attribute) i.next();
if (schemaLocationQName.equals(attr.getQName())) {
schemaLocation = attr.getText();
} else {
代码示例来源:origin: webx/citrus
Attribute attr = (Attribute) i.next();
if (schemaLocationQName.equals(attr.getQName())) {
schemaLocation = attr.getText();
} else {
代码示例来源:origin: org.dom4j/dom4j
public int compare(Element n1, Element n2) {
int answer = compare(n1.getQName(), n2.getQName());
if (answer == 0) {
// lets compare attributes
int c1 = n1.attributeCount();
int c2 = n2.attributeCount();
answer = c1 - c2;
if (answer == 0) {
for (int i = 0; i < c1; i++) {
Attribute a1 = n1.attribute(i);
Attribute a2 = n2.attribute(a1.getQName());
answer = compare(a1, a2);
if (answer != 0) {
return answer;
}
}
answer = compareContent(n1, n2);
}
}
return answer;
}
代码示例来源:origin: dom4j/dom4j
public Attribute attribute(QName qName) {
for (Attribute attribute : attributeList()) {
if (qName.equals(attribute.getQName())) {
return attribute;
}
}
return null;
}
代码示例来源:origin: dom4j/dom4j
protected void addToAttributeIndex(Attribute attribute) {
QName qName = attribute.getQName();
String name = qName.getName();
addToAttributeIndex(qName, attribute);
addToAttributeIndex(name, attribute);
}
内容来源于网络,如有侵权,请联系作者删除!