本文整理了Java中org.jdom2.Element.getNamespacePrefix()
方法的一些代码示例,展示了Element.getNamespacePrefix()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getNamespacePrefix()
方法的具体详情如下:
包路径:org.jdom2.Element
类名称:Element
方法名:getNamespacePrefix
[英]Returns the namespace prefix of the element or an empty string if none exists.
[中]返回元素的命名空间前缀,如果不存在,则返回空字符串。
代码示例来源: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
if (prefix.equals(getNamespacePrefix())) {
return getNamespace();
代码示例来源:origin: org.jdom/jdom
namespaces.put(getNamespacePrefix(), getNamespace());
if (additionalNamespaces != null) {
for (Namespace ns : getAdditionalNamespaces()) {
namespaces.remove(getNamespacePrefix());
al.addAll(namespaces.values());
代码示例来源:origin: org.codehaus.plexus/plexus-component-metadata
/**
* @return the namespace prefix.
* @see org.jdom2.Element#getNamespacePrefix()
*/
public String getNamespacePrefix()
{
return element.getNamespacePrefix();
}
代码示例来源:origin: org.jdom/jdom
out.add(eventfactory.createEndElement(element.getNamespacePrefix(),
element.getNamespaceURI(), element.getName(),
new NSIterator(nstack.addedReverse().iterator(), eventfactory)));
代码示例来源:origin: com.rometools/rome
private static void collectUsedPrefixes(final Element el, final Set<String> collector) {
final String prefix = el.getNamespacePrefix();
if (prefix != null && prefix.length() > 0 && !collector.contains(prefix)) {
collector.add(prefix);
}
final List<Element> kids = el.getChildren();
for (final Element kid : kids) {
// recursion- worth it
collectUsedPrefixes(kid, collector);
}
}
代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss
private static void collectUsedPrefixes(Element el, java.util.Set collector) {
String prefix = el.getNamespacePrefix();
if (prefix != null && prefix.length() > 0 && !collector.contains(prefix)) {
collector.add(prefix);
}
List kids = el.getChildren();
for (int i = 0; i < kids.size(); i++) {
collectUsedPrefixes((Element) kids.get(i), collector); // recursion - worth it
}
}
代码示例来源:origin: rometools/rome
private static void collectUsedPrefixes(final Element el, final Set<String> collector) {
final String prefix = el.getNamespacePrefix();
if (prefix != null && prefix.length() > 0 && !collector.contains(prefix)) {
collector.add(prefix);
}
final List<Element> kids = el.getChildren();
for (final Element kid : kids) {
// recursion- worth it
collectUsedPrefixes(kid, collector);
}
}
代码示例来源:origin: apache/marmotta
private static void collectUsedPrefixes(Element el, java.util.Set collector) {
String prefix = el.getNamespacePrefix();
if (prefix != null && prefix.length() > 0 && !collector.contains(prefix)) {
collector.add(prefix);
}
List kids = el.getChildren();
for (Object kid : kids) {
collectUsedPrefixes((Element) kid, collector); // recursion - worth it
}
}
代码示例来源:origin: miltonio/milton2
public static Set<QName> getProps(Document doc, Namespace propNs) {
Element elProp = doc.getRootElement().getChild("prop", propNs);
if (elProp == null) {
throw new RuntimeException("No prop element");
}
Set<QName> set = new HashSet<QName>();
for (Object o : elProp.getChildren()) {
if (o instanceof Element) {
Element el = (Element) o;
String local = el.getName();
String ns = el.getNamespaceURI();
set.add(new QName(ns, local, el.getNamespacePrefix()));
}
}
return set;
}
}
代码示例来源:origin: miltonio/milton2
private Set<QName> getProps(Document doc) {
Element elProp = doc.getRootElement().getChild("prop", NS_DAV);
if (elProp == null) {
throw new RuntimeException("No prop element");
}
Set<QName> set = new HashSet<QName>();
for (Object o : elProp.getChildren()) {
if (o instanceof Element) {
Element el = (Element) o;
String local = el.getName();
String ns = el.getNamespaceURI();
set.add(new QName(ns, local, el.getNamespacePrefix()));
}
}
return set;
}
}
代码示例来源:origin: miltonio/milton2
private Set<QName> getProps(Document doc) {
Element elProp = doc.getRootElement().getChild("prop", NS_DAV);
if (elProp == null) {
throw new RuntimeException("No prop element");
}
Set<QName> set = new HashSet<QName>();
for (Object o : elProp.getChildren()) {
if (o instanceof Element) {
Element el = (Element) o;
String local = el.getName();
String ns = el.getNamespaceURI();
set.add(new QName(ns, local, el.getNamespacePrefix()));
}
}
return set;
}
}
代码示例来源:origin: miltonio/milton2
private Set<QName> getProps(Document doc) {
Element elProp = doc.getRootElement().getChild("prop", NS_DAV);
if (elProp == null) {
throw new RuntimeException("No prop element");
}
Set<QName> set = new HashSet<QName>();
for (Object o : elProp.getChildren()) {
if (o instanceof Element) {
Element el = (Element) o;
String local = el.getName();
String ns = el.getNamespaceURI();
set.add(new QName(ns, local, el.getNamespacePrefix()));
}
}
return set;
}
}
代码示例来源:origin: miltonio/milton2
private Set<QName> getProps( Document doc )
{
Element elProp = doc.getRootElement().getChild( "prop", this.NS_DAV );
if ( elProp == null )
{
throw new RuntimeException( "No prop element" );
}
Set<QName> set = new HashSet<QName>();
for ( Object o : elProp.getChildren() )
{
if ( o instanceof Element )
{
Element el = (Element)o;
String local = el.getName();
String ns = el.getNamespaceURI();
set.add( new QName( ns, local, el.getNamespacePrefix() ) );
}
}
return set;
}
}
代码示例来源:origin: org.opencadc/cadc-util
if (StringUtil.hasText(e.getNamespacePrefix()))
w.print(e.getNamespacePrefix());
w.print(":");
代码示例来源:origin: org.codehaus.izpack/izpack-util
@Override
public void perform(Element originalElement, Element patchElement, Element outputParentElement)
throws AbstractXmlMergeException
{
logger.fine("Merging: " + originalElement + " (original) and " + patchElement + "(patch)");
Mapper mapper = (Mapper) m_mapperFactory.getOperation(originalElement, patchElement);
if (originalElement == null)
{
outputParentElement.addContent(mapper.map(patchElement));
}
else if (patchElement == null)
{
outputParentElement.addContent((Content) originalElement.clone());
}
else
{
Element workingElement = new Element(originalElement.getName(), originalElement
.getNamespacePrefix(), originalElement.getNamespaceURI());
addAttributes(workingElement, originalElement);
logger.fine("Adding " + workingElement);
outputParentElement.addContent(workingElement);
doIt(workingElement, originalElement, patchElement);
}
}
代码示例来源:origin: org.codehaus.izpack/izpack-util
@Override
public void perform(Element originalElement, Element patchElement, Element outputParentElement)
throws AbstractXmlMergeException
{
logger.fine("Merging: " + originalElement + " (original) and " + patchElement + " (patch)");
Mapper mapper = (Mapper) m_mapperFactory.getOperation(originalElement, patchElement);
if (originalElement == null)
{
outputParentElement.addContent(mapper.map(patchElement));
}
else if (patchElement == null)
{
outputParentElement.addContent((Content) originalElement.clone());
}
else
{
Element workingElement = new Element(originalElement.getName(), originalElement
.getNamespacePrefix(), originalElement.getNamespaceURI());
addAttributes(workingElement, originalElement);
logger.fine("Adding " + workingElement);
outputParentElement.addContent(workingElement);
doIt(workingElement, originalElement, patchElement);
}
}
代码示例来源:origin: io.wcm.tooling.commons/io.wcm.tooling.commons.crx-packmgr-helper
return;
collectNamespacePrefix(namespacePrefixesActuallyUsed, element.getNamespacePrefix());
代码示例来源:origin: org.opencadc/cadc-vosi
String nsp = doc.getRootElement().getNamespacePrefix(); //Namespace Prefix
if (nsp != null && nsp.length() > 0)
nsp = nsp + ":";
内容来源于网络,如有侵权,请联系作者删除!