本文整理了Java中org.jdom2.Element.getNamespace()
方法的一些代码示例,展示了Element.getNamespace()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getNamespace()
方法的具体详情如下:
包路径:org.jdom2.Element
类名称:Element
方法名:getNamespace
[英]Returns the element's Namespace.
[中]返回元素的命名空间。
代码示例来源:origin: gocd/gocd
private static boolean compareAttributeAwareConfigTag(Element e, AttributeAwareConfigTag attributeAwareConfigTag) {
return attributeAwareConfigTag.value().equals(e.getName()) &&
attributeAwareConfigTag.attributeValue().equals(e.getAttributeValue(attributeAwareConfigTag.attribute())) &&
e.getNamespace().getURI().equals(attributeAwareConfigTag.namespaceURI());
}
代码示例来源:origin: org.jdom/jdom
@Override
public final String getElementQName(Object element) {
Element e = (Element)element;
if (e.getNamespace().getPrefix().length() == 0) {
return e.getName();
}
return e.getNamespacePrefix() + ":" + e.getName();
}
代码示例来源:origin: org.jdom/jdom
namespaces.put(getNamespacePrefix(), getNamespace());
if (additionalNamespaces != null) {
for (Namespace ns : getAdditionalNamespaces()) {
al.add(getNamespace());
namespaces.remove(getNamespacePrefix());
al.addAll(namespaces.values());
代码示例来源:origin: org.jdom/jdom
try {
Namespace ns = element.getNamespace();
Iterator<Attribute> ait = element.hasAttributes() ?
element.getAttributes().iterator() :
代码示例来源:origin: org.jdom/jdom
((Element) content).getNamespace() == Namespace.NO_NAMESPACE) {
pnt.getChildren(emt.getName(), emt.getNamespace());
String xps = "*[local-name() = '" + emt.getName() +
"' and namespace-uri() = '" +
代码示例来源:origin: org.jdom/jdom
if (uri == null) {
ns = (current == null) ? Namespace.NO_NAMESPACE
: current.getNamespace(prefix);
代码示例来源:origin: gocd/gocd
public static boolean compare(Element e, Class<?> implementation, ConfigCache configCache) {
final AttributeAwareConfigTag attributeAwareConfigTag = annotationFor(implementation, AttributeAwareConfigTag.class);
if (attributeAwareConfigTag != null) {
return compareAttributeAwareConfigTag(e, attributeAwareConfigTag);
}
ConfigTag configTag = configTag(implementation, configCache);
return configTag.value().equals(e.getName()) && e.getNamespace().getURI().equals(configTag.namespaceURI());
}
代码示例来源:origin: org.jdom/jdom
return getNamespace();
return ((Element)parent).getNamespace(prefix);
代码示例来源:origin: gocd/gocd
@Test
public void shouldAddPluginNamespaceToPassedInElement() throws MalformedURLException {
ConfigElementImplementationRegistry registry = new ConfigElementImplementationRegistry(pluginExtns);
registry.xsdFor(PluginTestUtil.bundleCtxWithHeaders(m(PluginNamespace.XSD_NAMESPACE_PREFIX, "something", PluginNamespace.XSD_NAMESPACE_URI, "uri")), new File("file:///tmp/foo").toURI().toURL());
registry.xsdFor(PluginTestUtil.bundleCtxWithHeaders(m(PluginNamespace.XSD_NAMESPACE_PREFIX, "second", PluginNamespace.XSD_NAMESPACE_URI, "uri-1")), new File("file:///tmp/foo1").toURI().toURL());
Element foo = new Element("foo");
registry.registerNamespacesInto(foo);
assertThat(foo.getNamespace("something"), is(Namespace.getNamespace("something", "uri")));
assertThat(foo.getNamespace("second"), is(Namespace.getNamespace("second", "uri-1")));
}
代码示例来源:origin: org.jdom/jdom
/**
* This will take the supplied <code>{@link Element}</code> and transfer its
* namespaces to the global namespace storage.
*
* @param element
* <code>Element</code> to read namespaces from.
*/
private void transferNamespaces(final Element element) {
for (final Namespace ns : declaredNamespaces) {
if (ns != element.getNamespace()) {
element.addNamespaceDeclaration(ns);
}
}
declaredNamespaces.clear();
}
代码示例来源: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
final Element element) {
String reason = checkNamespaceCollision(namespace,
element.getNamespace());
if (reason != null) {
return reason + " with the element namespace prefix";
代码示例来源:origin: org.jdom/jdom
final Namespace mns = element.getNamespace();
代码示例来源:origin: org.jdom/jdom
Namespace ns = element.getNamespace();
if (ns == Namespace.NO_NAMESPACE) {
out.writeStartElement(element.getName());
Namespace ns = element.getNamespace();
if (ns == Namespace.NO_NAMESPACE) {
out.writeEmptyElement(element.getName());
代码示例来源: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: 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: 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 boolean isMyType(final Document document) {
final Element rssRoot = document.getRootElement();
final Namespace defaultNS = rssRoot.getNamespace();
return defaultNS != null && defaultNS.equals(getRSSNamespace()) && super.isMyType(document);
}
内容来源于网络,如有侵权,请联系作者删除!