org.jdom2.Element.setNamespace()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(138)

本文整理了Java中org.jdom2.Element.setNamespace()方法的一些代码示例,展示了Element.setNamespace()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.setNamespace()方法的具体详情如下:
包路径:org.jdom2.Element
类名称:Element
方法名:setNamespace

Element.setNamespace介绍

[英]Sets the element's Namespace. If the provided namespace is null, the element will have no namespace.
[中]设置元素的命名空间。如果提供的名称空间为null,则元素将没有名称空间。

代码示例

代码示例来源:origin: org.jdom/jdom

/**
 * Creates a new element with the supplied (local) name and namespace. If
 * the provided namespace is null, the element will have no namespace.
 *
 * @param  name                 local name of the element
 * @param  namespace            namespace for the element
 * @throws IllegalNameException if the given name is illegal as an element
 *                              name
 */
public Element(final String name, final Namespace namespace) {
  super(CType.Element);
  setName(name);
  setNamespace(namespace);
}

代码示例来源:origin: org.jdom/jdom

element.setNamespace(declaredNS);

代码示例来源:origin: org.codehaus.plexus/plexus-component-metadata

/**
 * @param namespace {@link Namespace}
 * @see org.jdom2.Element#setNamespace(org.jdom2.Namespace)
 * @return {@link Element}
 */
public Element setNamespace( Namespace namespace )
{
  return element.setNamespace( namespace );
}

代码示例来源:origin: Renanse/Ardor3D

/**
 * Strips the namespace from all nodes in a tree.
 *
 * @param rootElement
 *            Root of strip operation
 */
public void stripNamespace(final Element rootElement) {
  rootElement.setNamespace(null);
  final List<Element> children = rootElement.getChildren();
  final Iterator<Element> i = children.iterator();
  while (i.hasNext()) {
    final Element child = i.next();
    stripNamespace(child);
  }
}

代码示例来源:origin: org.openfuxml/ofx-wiki

private static synchronized Element unsetNameSpace(Element e)
  {
    e.setNamespace(null);
    for(Object o : e.getChildren())
    {
      Element eChild = (Element)o;
      eChild=unsetNameSpace(eChild);
    }
    return e;
  }
}

代码示例来源:origin: org.openfuxml/ofx-wiki

private synchronized static Element unsetNameSpace(Element e)
{
  e.setNamespace(null);
  for(Object o : e.getChildren())
  {
    Element eChild = (Element)o;
    eChild=unsetNameSpace(eChild);
  }
  return e;
}

代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss

private String parseTextConstructToString(Element e) {
  String value = null;
  String type = getAttributeValue(e, "type");
  type = (type!=null) ? type : Content.TEXT;
  if (type.equals(Content.XHTML) || (type.indexOf("/xml")) != -1 || (type.indexOf("+xml")) != -1) {
    // XHTML content needs special handling
    XMLOutputter outputter = new XMLOutputter();
    List eContent = e.getContent();
    Iterator i = eContent.iterator();
    while (i.hasNext()) {
      org.jdom2.Content c = (org.jdom2.Content) i.next();
      if (c instanceof Element) {
        Element eC = (Element) c;
        if (eC.getNamespace().equals(getAtomNamespace())) {
          ((Element)c).setNamespace(Namespace.NO_NAMESPACE);
        }
      }
    }
    value = outputter.outputString(eContent);
  } else {
    // Everything else comes in verbatim
    value = e.getText();
  }
  return value;
}

代码示例来源:origin: org.apache.jspwiki/jspwiki-main

m_webxml.getRootElement().setNamespace( Namespace.getNamespace( J2EE_SCHEMA_25_NAMESPACE ) );

代码示例来源:origin: rometools/rome

private String parseTextConstructToString(final Element e) {
  String type = getAttributeValue(e, "type");
  if (type == null) {
    type = Content.TEXT;
  }
  String value = null;
  if (type.equals(Content.XHTML) || type.indexOf("/xml") != -1 || type.indexOf("+xml") != -1) {
    // XHTML content needs special handling
    final XMLOutputter outputter = new XMLOutputter();
    final List<org.jdom2.Content> contents = e.getContent();
    for (final org.jdom2.Content content : contents) {
      if (content instanceof Element) {
        final Element element = (Element) content;
        if (element.getNamespace().equals(getAtomNamespace())) {
          element.setNamespace(Namespace.NO_NAMESPACE);
        }
      }
    }
    value = outputter.outputString(contents);
  } else {
    // Everything else comes in verbatim
    value = e.getText();
  }
  return value;
}

代码示例来源:origin: apache/marmotta

private String parseTextConstructToString(Element e) {
  String value = null;
  String type = getAttributeValue(e, "type");
  type = (type!=null) ? type : Content.TEXT;
  if (type.equals(Content.XHTML) || (type.indexOf("/xml")) != -1 || (type.indexOf("+xml")) != -1) {
    // XHTML content needs special handling
    XMLOutputter outputter = new XMLOutputter();
    List eContent = e.getContent();
    for (Object anEContent : eContent) {
      org.jdom2.Content c = (org.jdom2.Content) anEContent;
      if (c instanceof Element) {
        Element eC = (Element) c;
        if (eC.getNamespace().equals(getAtomNamespace())) {
          ((Element) c).setNamespace(Namespace.NO_NAMESPACE);
        }
      }
    }
    value = outputter.outputString(eContent);
  } else {
    // Everything else comes in verbatim
    value = e.getText();
  }
  return value;
}

代码示例来源:origin: com.rometools/rome

private String parseTextConstructToString(final Element e) {
  String type = getAttributeValue(e, "type");
  if (type == null) {
    type = Content.TEXT;
  }
  String value = null;
  if (type.equals(Content.XHTML) || type.indexOf("/xml") != -1 || type.indexOf("+xml") != -1) {
    // XHTML content needs special handling
    final XMLOutputter outputter = new XMLOutputter();
    final List<org.jdom2.Content> contents = e.getContent();
    for (final org.jdom2.Content content : contents) {
      if (content instanceof Element) {
        final Element element = (Element) content;
        if (element.getNamespace().equals(getAtomNamespace())) {
          element.setNamespace(Namespace.NO_NAMESPACE);
        }
      }
    }
    value = outputter.outputString(contents);
  } else {
    // Everything else comes in verbatim
    value = e.getText();
  }
  return value;
}

代码示例来源:origin: org.apache.marmotta/sesame-tools-rio-rss

Element eC = (Element) c;
if (eC.getNamespace().equals(getAtomNamespace())) {
  ((Element)c).setNamespace(Namespace.NO_NAMESPACE);

代码示例来源:origin: rometools/rome

final Element element = (Element) content;
if (element.getNamespace().equals(getAtomNamespace())) {
  element.setNamespace(Namespace.NO_NAMESPACE);

代码示例来源:origin: com.rometools/rome

final Element element = (Element) content;
if (element.getNamespace().equals(getAtomNamespace())) {
  element.setNamespace(Namespace.NO_NAMESPACE);

代码示例来源:origin: apache/marmotta

Element eC = (Element) c;
if (eC.getNamespace().equals(getAtomNamespace())) {
  ((Element) c).setNamespace(Namespace.NO_NAMESPACE);

代码示例来源:origin: Vhati/Slipstream-Mod-Manager

newNode.setNamespace( null );
contextNode.addContent( newNode );
newNode.setNamespace( null );

代码示例来源:origin: org.apache.maven.plugins/maven-shade-plugin

root.setNamespace( pomNamespace );

相关文章

微信公众号

最新文章

更多