本文整理了Java中org.dom4j.Attribute.getParent()
方法的一些代码示例,展示了Attribute.getParent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute.getParent()
方法的具体详情如下:
包路径:org.dom4j.Attribute
类名称:Attribute
方法名:getParent
暂无
代码示例来源: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: maven/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: 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.jenkins-ci.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.apache.servicemix.bundles/org.apache.servicemix.bundles.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: com.alibaba.citrus.tool/antx-autoexpand
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/com.springsource.org.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/org.motechproject.org.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: apache/servicemix-bundles
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: 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: com.alibaba.citrus.tool/antx-autoexpand
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: org.dom4j/org.motechproject.org.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: org.apache.servicemix.bundles/org.apache.servicemix.bundles.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: org.dom4j/com.springsource.org.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: maven/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: org.jenkins-ci.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: dom4j/dom4j
Element element = attribute.getParent();
attribute.getParent() == element);
代码示例来源:origin: dom4j/dom4j
protected void testAttributeDefaultPrefix(Document document) throws Exception {
List<Node> list = document.selectNodes("//@*[local-name()='actor']");
assertTrue("Matched at least one 'actor' attribute", list.size() > 0);
for (Node node : list) {
Attribute attribute = (Attribute) node;
log("found: " + attribute.asXML());
Element element = attribute.getParent();
assertTrue("Attribute has a parent", element != null);
Namespace ns = element.getNamespaceForPrefix("");
String uri = "http://schemas.xmlsoap.org/soap/envelope/";
assertNamespace(ns, "", uri);
Namespace ns2 = attribute.getNamespace();
// Note that namespaces do not inherit the default namespace!
assertNamespace(ns2, "", "");
}
}
代码示例来源:origin: dom4j/dom4j
protected void testXPath(String xpathText) {
XPath xpath = DocumentHelper.createXPath(xpathText);
List<Node> list = xpath.selectNodes(document);
log("Searched path: " + xpathText + " found: " + list.size()
+ " result(s)");
for (Node node : list) {
log("Found Result: " + node);
assertTrue("Results should be Attribute objects", node instanceof Attribute);
Attribute attribute = (Attribute) node;
assertTrue("Results should support the parent relationship", attribute.supportsParent());
assertTrue("Results should contain reference to the parent element", attribute.getParent() != null);
assertTrue("Resulting document not correct", attribute.getDocument() != null);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!