本文整理了Java中org.dom4j.Namespace.equals()
方法的一些代码示例,展示了Namespace.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Namespace.equals()
方法的具体详情如下:
包路径:org.dom4j.Namespace
类名称:Namespace
方法名:equals
[英]Checks whether this Namespace equals the given Namespace. Two Namespaces are equals if their URI and prefix are equal.
[中]检查此命名空间是否等于给定命名空间。如果两个名称空间的URI和前缀相等,则它们是相等的。
代码示例来源:origin: igniterealtime/Openfire
public Deliverable(Collection<Packet> elements) {
this.text = null;
this.packets = new ArrayList<>();
for (Packet packet : elements) {
// Append packet namespace according XEP-0206 if needed
if (Namespace.NO_NAMESPACE.equals(packet.getElement().getNamespace())) {
// use string-based operation here to avoid cascading xmlns wonkery
StringBuilder packetXml = new StringBuilder(packet.toXML());
final int noslash = packetXml.indexOf( ">" );
final int slash = packetXml.indexOf( "/>" );
final int insertAt = ( noslash - 1 == slash ? slash : noslash );
packetXml.insert( insertAt, " xmlns=\"jabber:client\"");
this.packets.add(packetXml.toString());
} else {
this.packets.add(packet.toXML());
}
}
}
代码示例来源:origin: igniterealtime/Openfire
@Override
public void deliver(Packet packet) throws UnauthorizedException
{
final String xml;
if (Namespace.NO_NAMESPACE.equals(packet.getElement().getNamespace())) {
// use string-based operation here to avoid cascading xmlns wonkery
StringBuilder packetXml = new StringBuilder(packet.toXML());
packetXml.insert(packetXml.indexOf(" "), " xmlns=\"jabber:client\"");
xml = packetXml.toString();
} else {
xml = packet.toXML();
}
if (validate()) {
deliverRawText(xml);
} else {
// use fallback delivery mechanism (offline)
getPacketDeliverer().deliver(packet);
}
}
代码示例来源:origin: igniterealtime/Openfire
if (Namespace.NO_NAMESPACE.equals(el.getNamespace())) {
continue;
代码示例来源:origin: org.dom4j/dom4j
/**
* Implements an identity based comparsion using the parent element as well
* as the prefix and URI
*
* @param object
* DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
public boolean equals(Object object) {
if (object instanceof DefaultNamespace) {
DefaultNamespace that = (DefaultNamespace) object;
if (that.parent == parent) {
return super.equals(object);
}
}
return false;
}
代码示例来源:origin: org.dom4j/dom4j
/**
* DOCUMENT ME!
*
* @param namespace
* DOCUMENT ME!
* @param namespaceStack
* DOCUMENT ME!
*
* @return true if the given namespace is an ignorable namespace (such as
* Namespace.NO_NAMESPACE or Namespace.XML_NAMESPACE) or if the
* namespace has already been declared in the current scope
*/
protected boolean isIgnoreableNamespace(Namespace namespace,
NamespaceStack namespaceStack) {
if (namespace.equals(Namespace.NO_NAMESPACE)
|| namespace.equals(Namespace.XML_NAMESPACE)) {
return true;
}
String uri = namespace.getURI();
if ((uri == null) || (uri.length() <= 0)) {
return true;
}
return namespaceStack.contains(namespace);
}
代码示例来源:origin: org.dom4j/dom4j
public QName(String name, Namespace namespace) {
this.name = (name == null) ? "" : name;
this.namespace = (namespace == null) ? Namespace.NO_NAMESPACE
: namespace;
if (this.namespace.equals(Namespace.NO_NAMESPACE)) {
validateName(this.name);
} else {
validateNCName(this.name);
}
}
代码示例来源:origin: org.dom4j/dom4j
public List<Namespace> additionalNamespaces() {
BackedList<Namespace> answer = createResultList();
for (Node node : contentList()) {
if (node instanceof Namespace) {
Namespace namespace = (Namespace) node;
if (!namespace.equals(getNamespace())) {
answer.addLocal(namespace);
}
}
}
return answer;
}
代码示例来源:origin: org.dom4j/dom4j
public List<Namespace> additionalNamespaces() {
final Object contentShadow = content;
if (contentShadow instanceof List) {
List<Node> list = (List<Node>) contentShadow;
BackedList<Namespace> answer = createResultList();
for (Node node : list) {
if (node instanceof Namespace) {
Namespace namespace = (Namespace) node;
if (!namespace.equals(getNamespace())) {
answer.addLocal(namespace);
}
}
}
return answer;
} else {
if (contentShadow instanceof Namespace) {
Namespace namespace = (Namespace) contentShadow;
if (namespace.equals(getNamespace())) {
return createEmptyList();
}
return createSingleResultList(namespace);
} else {
return createEmptyList();
}
}
}
代码示例来源:origin: org.dom4j/com.springsource.org.dom4j
/**
* Implements an identity based comparsion using the parent element as well
* as the prefix and URI
*
* @param object
* DOCUMENT ME!
*
* @return DOCUMENT ME!
*/
public boolean equals(Object object) {
if (object instanceof DefaultNamespace) {
DefaultNamespace that = (DefaultNamespace) object;
if (that.parent == parent) {
return super.equals(object);
}
}
return false;
}
代码示例来源:origin: dom4j/dom4j
public QName(String name, Namespace namespace) {
this.name = (name == null) ? "" : name;
this.namespace = (namespace == null) ? Namespace.NO_NAMESPACE
: namespace;
if (this.namespace.equals(Namespace.NO_NAMESPACE)) {
validateName(this.name);
} else {
validateNCName(this.name);
}
}
代码示例来源:origin: apache/servicemix-bundles
public QName(String name, Namespace namespace) {
this.name = (name == null) ? "" : name;
this.namespace = (namespace == null) ? Namespace.NO_NAMESPACE
: namespace;
if (this.namespace.equals(Namespace.NO_NAMESPACE)) {
validateName(this.name);
} else {
validateNCName(this.name);
}
}
代码示例来源:origin: se.kb/oai4j
private void addTypesAndMetadata(AggregateBase aggregate, List<Node> nodes) {
for (Node node : nodes) {
Element element = (Element) node;
if (element.getNamespace().equals(DC_NS)) {
aggregate.addMetadata((new Metadata(Namespace.DC, element.getName(), element.getText())));
}
else if (element.getNamespace().equals(DCTERMS_NS)) {
aggregate.addMetadata((new Metadata(Namespace.DCTERMS, element.getName(), element.getText())));
}
else if (element.getNamespace().equals(RDF_NS) && element.getName().equals("type")) {
aggregate.addType(new Type(element.getText()));
}
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j
public List additionalNamespaces() {
List list = contentList();
int size = list.size();
BackedList answer = createResultList();
for (int i = 0; i < size; i++) {
Object object = list.get(i);
if (object instanceof Namespace) {
Namespace namespace = (Namespace) object;
if (!namespace.equals(getNamespace())) {
answer.addLocal(namespace);
}
}
}
return answer;
}
代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand
public List additionalNamespaces() {
List list = contentList();
int size = list.size();
BackedList answer = createResultList();
for (int i = 0; i < size; i++) {
Object object = list.get(i);
if (object instanceof Namespace) {
Namespace namespace = (Namespace) object;
if (!namespace.equals(getNamespace())) {
answer.addLocal(namespace);
}
}
}
return answer;
}
代码示例来源:origin: org.dom4j/com.springsource.org.dom4j
public List additionalNamespaces() {
List list = contentList();
int size = list.size();
BackedList answer = createResultList();
for (int i = 0; i < size; i++) {
Object object = list.get(i);
if (object instanceof Namespace) {
Namespace namespace = (Namespace) object;
if (!namespace.equals(getNamespace())) {
answer.addLocal(namespace);
}
}
}
return answer;
}
代码示例来源:origin: org.dom4j/org.motechproject.org.dom4j
public List additionalNamespaces() {
List list = contentList();
int size = list.size();
BackedList answer = createResultList();
for (int i = 0; i < size; i++) {
Object object = list.get(i);
if (object instanceof Namespace) {
Namespace namespace = (Namespace) object;
if (!namespace.equals(getNamespace())) {
answer.addLocal(namespace);
}
}
}
return answer;
}
代码示例来源:origin: org.jenkins-ci.dom4j/dom4j
public List additionalNamespaces() {
List list = contentList();
int size = list.size();
BackedList answer = createResultList();
for (int i = 0; i < size; i++) {
Object object = list.get(i);
if (object instanceof Namespace) {
Namespace namespace = (Namespace) object;
if (!namespace.equals(getNamespace())) {
answer.addLocal(namespace);
}
}
}
return answer;
}
代码示例来源:origin: maven/dom4j
public List additionalNamespaces() {
List list = contentList();
int size = list.size();
BackedList answer = createResultList();
for (int i = 0; i < size; i++) {
Object object = list.get(i);
if (object instanceof Namespace) {
Namespace namespace = (Namespace) object;
if (!namespace.equals(getNamespace())) {
answer.addLocal(namespace);
}
}
}
return answer;
}
代码示例来源:origin: dom4j/dom4j
public List<Namespace> additionalNamespaces() {
BackedList<Namespace> answer = createResultList();
for (Node node : contentList()) {
if (node instanceof Namespace) {
Namespace namespace = (Namespace) node;
if (!namespace.equals(getNamespace())) {
answer.addLocal(namespace);
}
}
}
return answer;
}
代码示例来源:origin: apache/servicemix-bundles
public List<Namespace> additionalNamespaces() {
BackedList<Namespace> answer = createResultList();
for (Node node : contentList()) {
if (node instanceof Namespace) {
Namespace namespace = (Namespace) node;
if (!namespace.equals(getNamespace())) {
answer.addLocal(namespace);
}
}
}
return answer;
}
内容来源于网络,如有侵权,请联系作者删除!