本文整理了Java中org.jdom2.Namespace.equals()
方法的一些代码示例,展示了Namespace.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Namespace.equals()
方法的具体详情如下:
包路径:org.jdom2.Namespace
类名称:Namespace
方法名:equals
[英]This tests for equality - Two Namespaces
are equal if and only if their URIs are byte-for-byte equals.
[中]这个测试是否相等——两个Namespaces
当且仅当它们的URI是字节对字节相等时才相等。
代码示例来源:origin: org.jdom/jdom
/**
* Returns whether the two filters are equivalent (i.e. the
* matching names and namespace are equivalent).
*
* @param obj the object to compare against
* @return whether the two filters are equal
*/
@Override
public boolean equals(Object obj) {
// Generated by IntelliJ
if (this == obj) return true;
if (!(obj instanceof AttributeFilter)) return false;
final AttributeFilter filter = (AttributeFilter) obj;
if (name != null ? !name.equals(filter.name) : filter.name != null) return false;
if (namespace != null ? !namespace.equals(filter.namespace) : filter.namespace != null) return false;
return true;
}
代码示例来源:origin: org.jdom/jdom
/**
* Returns whether the two filters are equivalent (i.e. the
* matching names and namespace are equivalent).
*
* @param obj the object to compare against
* @return whether the two filters are equal
*/
@Override
public boolean equals(Object obj) {
// Generated by IntelliJ
if (this == obj) return true;
if (!(obj instanceof ElementFilter)) return false;
final ElementFilter filter = (ElementFilter) obj;
if (name != null ? !name.equals(filter.name) : filter.name != null) return false;
if (namespace != null ? !namespace.equals(filter.namespace) : filter.namespace != null) return false;
return true;
}
代码示例来源:origin: org.jdom/jdom
/**
* Check to see if the Content matches a predefined set of rules.
*
* @param content The Content to verify.
* @return <code>true</code> if the objected matched a predfined
* set of rules.
*/
@Override
public Attribute filter(Object content) {
if (content instanceof Attribute) {
Attribute att = (Attribute) content;
if (name == null) {
if (namespace == null) {
return att;
}
return namespace.equals(att.getNamespace()) ? att : null;
}
if (!name.equals(att.getName())) {
return null;
}
if (namespace == null) {
return att;
}
return namespace.equals(att.getNamespace()) ? att : null;
}
return null;
}
代码示例来源:origin: org.jdom/jdom
/**
* Check to see if the object matches a predefined set of rules.
*
* @param content The object to verify.
* @return <code>true</code> if the objected matched a predfined
* set of rules.
*/
@Override
public Element filter(Object content) {
if (content instanceof Element) {
Element el = (Element) content;
if (name == null) {
if (namespace == null) {
return el;
}
return namespace.equals(el.getNamespace()) ? el : null;
}
if (!name.equals(el.getName())) {
return null;
}
if (namespace == null) {
return el;
}
return namespace.equals(el.getNamespace()) ? el : null;
}
return null;
}
代码示例来源:origin: org.jdom/jdom
/**
* Check if a <code>{@link Namespace}</code> collides with a
* <code>{@link Attribute}</code>'s namespace.
*
* @param namespace <code>Namespace</code> to check.
* @param attribute <code>Attribute</code> to check against.
* @return <code>String</code> reason for collision, or
* <code>null</code> if no collision.
*/
public static String checkNamespaceCollision(final Namespace namespace,
final Attribute attribute) {
String reason = null;
if (!attribute.getNamespace().equals(Namespace.NO_NAMESPACE)) {
reason = checkNamespaceCollision(namespace,
attribute.getNamespace());
if (reason != null) {
reason += " with an attribute namespace prefix on the element";
}
}
return reason;
}
代码示例来源:origin: com.atlassian.maven.plugins/maven-jgitflow-plugin
public static Namespace getNamespaceOrNull(Element container)
{
Namespace ns = container.getNamespace();
if(ns.equals(Namespace.NO_NAMESPACE))
{
return null;
}
return ns;
}
代码示例来源:origin: org.mycore/mycore-mods
public void addElement(Element element) {
if (!element.getNamespace().equals(MCRConstants.MODS_NAMESPACE)) {
throw new IllegalArgumentException("given element is no mods element");
}
insertTopLevelElement(element);
}
代码示例来源:origin: rometools/rome
private boolean hasElementsFrom(final Element root, final Namespace namespace) {
boolean hasElements = false;
for (final Element child : root.getChildren()) {
final Namespace childNamespace = child.getNamespace();
if (namespace.equals(childNamespace)) {
hasElements = true;
break;
}
}
return hasElements;
}
代码示例来源:origin: com.rometools/rome
private boolean hasElementsFrom(final Element root, final Namespace namespace) {
boolean hasElements = false;
for (final Element child : root.getChildren()) {
final Namespace childNamespace = child.getNamespace();
if (namespace.equals(childNamespace)) {
hasElements = true;
break;
}
}
return hasElements;
}
代码示例来源:origin: rometools/rome
@Override
public boolean isMyType(final Document document) {
final Element rssRoot = document.getRootElement();
final Namespace defaultNS = rssRoot.getNamespace();
return defaultNS != null && defaultNS.equals(getAtomNamespace());
}
代码示例来源:origin: rometools/rome
@Override
public void generate(final Module module, final Element element) {
Element root = element;
while (root.getParentElement() != null) {
root = root.getParentElement();
}
if (root.getNamespace().equals(RDF) || root.getNamespace().equals(RSS)) {
generateRSS1((CreativeCommons) module, element);
} else {
generateRSS2((CreativeCommons) module, element);
}
}
代码示例来源:origin: rometools/rome
@Override
public boolean isMyType(final Document document) {
final Element rssRoot = document.getRootElement();
final Namespace defaultNS = rssRoot.getNamespace();
return defaultNS != null && defaultNS.equals(getAtomNamespace());
}
代码示例来源:origin: com.rometools/rome
@Override
public boolean isMyType(final Document document) {
final Element rssRoot = document.getRootElement();
final Namespace defaultNS = rssRoot.getNamespace();
return defaultNS != null && defaultNS.equals(getAtomNamespace());
}
代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss
public boolean isMyType(Document document) {
Element rssRoot = document.getRootElement();
Namespace defaultNS = rssRoot.getNamespace();
return (defaultNS!=null) && defaultNS.equals(getAtomNamespace());
}
代码示例来源:origin: com.rometools/rome
@Override
public boolean isMyType(final Document document) {
final Element rssRoot = document.getRootElement();
final Namespace defaultNS = rssRoot.getNamespace();
return defaultNS != null && defaultNS.equals(getAtomNamespace());
}
代码示例来源:origin: apache/marmotta
public boolean isMyType(Document document) {
Element rssRoot = document.getRootElement();
Namespace defaultNS = rssRoot.getNamespace();
return (defaultNS!=null) && defaultNS.equals(getAtomNamespace());
}
代码示例来源:origin: rometools/rome
@Override
public boolean isMyType(final Document document) {
final Element rssRoot = document.getRootElement();
final Namespace defaultNS = rssRoot.getNamespace();
return defaultNS != null && defaultNS.equals(getRSSNamespace()) && super.isMyType(document);
}
代码示例来源:origin: com.rometools/rome
@Override
public boolean isMyType(final Document document) {
final Element rssRoot = document.getRootElement();
final Namespace defaultNS = rssRoot.getNamespace();
return defaultNS != null && defaultNS.equals(getRSSNamespace()) && super.isMyType(document);
}
代码示例来源:origin: apache/marmotta
public boolean isMyType(Document document) {
Element rssRoot = document.getRootElement();
Namespace defaultNS = rssRoot.getNamespace();
boolean ok = defaultNS!=null && defaultNS.equals(getRSSNamespace());
if (ok) {
ok = super.isMyType(document);
}
return ok;
}
代码示例来源:origin: org.mycore/mycore-mods
public static void assignCategory(org.jdom2.Element modsElement, MCRCategoryID categID) {
MCRAuthorityInfo authInfo = modsElement.getNamespace().equals(MCRConstants.MODS_NAMESPACE)
? getAuthInfo(categID, modsElement.getName())
: null;
if (authInfo == null) {
throw new MCRException(modsElement.getQualifiedName() + " could not be assigned to category " + categID);
}
authInfo.setInElement(modsElement);
}
内容来源于网络,如有侵权,请联系作者删除!