本文整理了Java中org.dom4j.Element.getQName()
方法的一些代码示例,展示了Element.getQName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getQName()
方法的具体详情如下:
包路径:org.dom4j.Element
类名称:Element
方法名:getQName
[英]Returns the QName
of this element which represents the local name, the qualified name and the Namespace
.
[中]返回此元素的QName
,它表示本地名称、限定名称和Namespace
。
代码示例来源:origin: org.freemarker/freemarker
@Override
void getChildren(Object node, String localName, String namespaceUri, List result) {
if (node instanceof Element) {
Element e = (Element) node;
if (localName == null) {
result.addAll(e.elements());
} else {
result.addAll(e.elements(e.getQName().getDocumentFactory().createQName(localName, "", namespaceUri)));
}
} else if (node instanceof Document) {
Element root = ((Document) node).getRootElement();
if (localName == null || (equal(root.getName(), localName) && equal(root.getNamespaceURI(), namespaceUri))) {
result.add(root);
}
}
}
代码示例来源:origin: Tencent/tinker
final Element incAppNode = incXmlDoc.addElement(newAppNode.getQName());
copyAttributes(newAppNode, incAppNode);
代码示例来源:origin: org.freemarker/freemarker
result.addAll(e.attributes());
} else {
Attribute attr = e.attribute(e.getQName().getDocumentFactory().createQName(localName, "", namespaceUri));
if (attr != null) {
result.add(attr);
代码示例来源:origin: igniterealtime/Openfire
&& !(el.getQName().equals(QName.get("rtt", "urn:xmpp:rtt:0")))
) {
return true;
代码示例来源:origin: org.dom4j/dom4j
/**
* DOCUMENT ME!
*
* @param object
* DOCUMENT ME!
*
* @return true if the given element implements the {@link Element}
* interface and matches the given {@link QName}
*/
protected boolean matches(Node object) {
if (object instanceof Element) {
Element element = (Element) object;
return qName.equals(element.getQName());
}
return false;
}
}
代码示例来源:origin: org.dom4j/dom4j
public Element element(QName qName) {
final Object contentShadow = content;
if (contentShadow instanceof List) {
List<Node> list = (List<Node>) contentShadow;
for (Node node : list) {
if (node instanceof Element) {
Element element = (Element) node;
if (qName.equals(element.getQName())) {
return element;
}
}
}
} else {
if (contentShadow instanceof Element) {
Element element = (Element) contentShadow;
if (qName.equals(element.getQName())) {
return element;
}
}
}
return null;
}
代码示例来源:origin: org.dom4j/dom4j
public Element element(QName qName) {
for (Node node : contentList()) {
if (node instanceof Element) {
Element element = (Element) node;
if (qName.equals(element.getQName())) {
return element;
}
}
}
return null;
}
代码示例来源:origin: org.dom4j/dom4j
element = parent.element(parent.getQName(name));
} else {
element = parent.element(name);
代码示例来源:origin: org.dom4j/dom4j
protected void removeFromElementIndex(Element element) {
QName qName = element.getQName();
String name = qName.getName();
removeFromElementIndex(qName, element);
removeFromElementIndex(name, element);
}
代码示例来源:origin: org.dom4j/dom4j
protected void addToElementIndex(Element element) {
QName qName = element.getQName();
String name = qName.getName();
addToElementIndex(qName, element);
addToElementIndex(name, element);
}
代码示例来源:origin: org.dom4j/dom4j
/**
* Constructs a STAX {@link EndElement}event from a DOM4J {@link Element}.
*
* @param elem
* The {@link Element}from which to construct the event.
*
* @return The newly constructed {@link EndElement}event.
*/
public EndElement createEndElement(Element elem) {
QName tagName = createQName(elem.getQName());
Iterator<javax.xml.stream.events.Namespace> nsIter = new NamespaceIterator(elem.declaredNamespaces()
.iterator());
return factory.createEndElement(tagName, nsIter);
}
代码示例来源:origin: org.dom4j/dom4j
public List<Element> elements(QName qName) {
BackedList<Element> answer = createResultList();
for (Node node : contentList()) {
if (node instanceof Element) {
Element element = (Element) node;
if (qName.equals(element.getQName())) {
answer.addLocal(element);
}
}
}
return answer;
}
代码示例来源: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: org.dom4j/dom4j
/**
* Constructs a STAX {@link StartElement}event from a DOM4J {@link
* Element}.
*
* @param elem
* The {@link Element}from which to construct the event.
*
* @return The newly constructed {@link StartElement}event.
*/
public StartElement createStartElement(Element elem) {
// create name
QName tagName = createQName(elem.getQName());
// create attribute & namespace iterators
Iterator<javax.xml.stream.events.Attribute> attrIter = new AttributeIterator(elem.attributeIterator());
Iterator<javax.xml.stream.events.Namespace> nsIter = new NamespaceIterator(elem.declaredNamespaces()
.iterator());
// create start event
return factory.createStartElement(tagName, attrIter, nsIter);
}
代码示例来源:origin: webx/citrus
private void visitElements(List<Element> elements) {
List<Integer> indexes = createLinkedList();
int index = 0;
for (Element subElement : elements) {
if (subElement.getQName().equals(XSD_ANY) && subElement.attribute("namespace") != null) {
String ns = subElement.attribute("namespace").getValue();
ConfigurationPoint cp = cps.getConfigurationPointByNamespaceUri(ns);
if (cp != null) {
indexes.add(index);
importings.put(ns, cp);
}
visitDependedConfigurationPoint(cp);
} else {
visitElement(subElement);
}
index++;
}
for (Integer i : indexes) {
visitAnyElement(elements, i);
}
}
代码示例来源:origin: webx/citrus
private void visitElements(List<Element> elements) {
List<Integer> indexes = createLinkedList();
int index = 0;
for (Element subElement : elements) {
if (subElement.getQName().equals(XSD_ANY) && subElement.attribute("namespace") != null) {
String ns = subElement.attribute("namespace").getValue();
ConfigurationPoint cp = cps.getConfigurationPointByNamespaceUri(ns);
if (cp != null) {
indexes.add(index);
importings.put(ns, cp);
}
visitDependedConfigurationPoint(cp);
} else {
visitElement(subElement);
}
index++;
}
for (Integer i : indexes) {
visitAnyElement(elements, i);
}
}
代码示例来源:origin: webx/citrus
private void visitElements(List<Element> elements) {
List<Integer> indexes = createLinkedList();
int index = 0;
for (Element subElement : elements) {
if (subElement.getQName().equals(XSD_ANY) && subElement.attribute("namespace") != null) {
String ns = subElement.attribute("namespace").getValue();
ConfigurationPoint cp = cps.getConfigurationPointByNamespaceUri(ns);
if (cp != null) {
indexes.add(index);
importings.put(ns, cp);
}
visitDependedConfigurationPoint(cp);
} else {
visitElement(subElement);
}
index++;
}
for (Integer i : indexes) {
visitAnyElement(elements, i);
}
}
代码示例来源:origin: dom4j/dom4j
public Element element(QName qName) {
for (Node node : contentList()) {
if (node instanceof Element) {
Element element = (Element) node;
if (qName.equals(element.getQName())) {
return element;
}
}
}
return null;
}
代码示例来源:origin: dom4j/dom4j
protected void removeFromElementIndex(Element element) {
QName qName = element.getQName();
String name = qName.getName();
removeFromElementIndex(qName, element);
removeFromElementIndex(name, element);
}
代码示例来源:origin: dom4j/dom4j
public List<Element> elements(QName qName) {
BackedList<Element> answer = createResultList();
for (Node node : contentList()) {
if (node instanceof Element) {
Element element = (Element) node;
if (qName.equals(element.getQName())) {
answer.addLocal(element);
}
}
}
return answer;
}
内容来源于网络,如有侵权,请联系作者删除!