org.dom4j.Element.getParent()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(235)

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

Element.getParent介绍

暂无

代码示例

代码示例来源:origin: com.thoughtworks.xstream/xstream

protected Object getParent() {
  return currentElement.getParent();
}

代码示例来源:origin: gocd/gocd

protected ConfigSaveState updatePartial(String xmlPartial, final String md5) throws Exception {
  LOGGER.debug("[Config Save] Updating partial");
  Document document = documentRoot();
  Element root = document.getRootElement();
  Element configElement = ((Element) root.selectSingleNode(getXpath()));
  List nodes = configElement.getParent().content();
  int index = nodes.indexOf(configElement);
  LOGGER.debug("[Config Save] Converting to object");
  Element newConfigElement = reader.read(new StringReader(xmlPartial)).getRootElement();
  nodes.set(index, newConfigElement);
  return saveConfig(document.asXML(), md5);
}

代码示例来源:origin: jaxen/jaxen

List nsList = new ArrayList();
HashSet prefixes = new HashSet();
for ( Element context = element; context != null; context = context.getParent() ) {
  List declaredNS = new ArrayList(context.declaredNamespaces());
  declaredNS.add(context.getNamespace());

代码示例来源:origin: igniterealtime/Openfire

/**
 * Deletes the specified property.
 *
 * @param name the property to delete.
 */
public synchronized void deleteProperty(String name) {
  // Remove property from cache.
  propertyCache.remove(name);
  String[] propName = parsePropertyName(name);
  // Search for this property by traversing down the XML hierarchy.
  Element element = document.getRootElement();
  for (int i = 0; i < propName.length - 1; i++) {
    element = element.element(propName[i]);
    // Can't find the property so return.
    if (element == null) {
      return;
    }
  }
  // Found the correct element to remove, so remove it...
  element.remove(element.element(propName[propName.length - 1]));
  if (element.elements().size() == 0) {
    element.getParent().remove(element);
  }
  // .. then write to disk.
  saveProperties();
  JiveGlobals.setPropertyEncrypted(name, false);
  // Generate event.
  Map<String, Object> params = Collections.emptyMap();
  PropertyEventDispatcher.dispatchEvent(name, PropertyEventDispatcher.EventType.xml_property_deleted, params);
}

代码示例来源:origin: pentaho/pentaho-kettle

public void prepareNSMap( Element l ) {
 @SuppressWarnings( "unchecked" )
 List<Namespace> namespacesList = l.declaredNamespaces();
 for ( Namespace ns : namespacesList ) {
  if ( ns.getPrefix().trim().length() == 0 ) {
   data.NAMESPACE.put( "pre" + data.NSPath.size(), ns.getURI() );
   String path = "";
   Element element = l;
   while ( element != null ) {
    if ( element.getNamespacePrefix() != null && element.getNamespacePrefix().length() > 0 ) {
     path = GetXMLDataMeta.N0DE_SEPARATOR + element.getNamespacePrefix() + ":" + element.getName() + path;
    } else {
     path = GetXMLDataMeta.N0DE_SEPARATOR + element.getName() + path;
    }
    element = element.getParent();
   }
   data.NSPath.add( path );
  } else {
   data.NAMESPACE.put( ns.getPrefix(), ns.getURI() );
  }
 }
 @SuppressWarnings( "unchecked" )
 List<Element> elementsList = l.elements();
 for ( Element e : elementsList ) {
  prepareNSMap( e );
 }
}

代码示例来源:origin: igniterealtime/Openfire

pageID = subPage.getParent().getParent().attributeValue("id");
if (current != null) {
  if (subcurrent != null) {
    subnav = subcurrent.getParent().getParent().getParent();
    subnav = current.getParent();

代码示例来源:origin: igniterealtime/Openfire

Element subPage = AdminConsole.getElemnetByID(subPageID);
if (subPage != null) {
  pageID = subPage.getParent().getParent().attributeValue("id");

代码示例来源:origin: igniterealtime/Openfire

pageID = subPage.getParent().getParent().attributeValue("id");
  subnav = current.getParent();
  isSubmenu = subcurrent.getParent().getParent().getName().equals("item");
  Element sidebar = subnav.getParent().getParent();
        Iterator siblings = subcurrent.getParent().elementIterator();
        boolean hadNext = siblings.hasNext();
        if (hadNext) {
          String subheader = subcurrent.getParent().attributeValue("name");
          pluginName = subcurrent.getParent().attributeValue("plugin");
          buf.append("<li class=\"").append(hcss).append("\">").append(
              clean(AdminConsole.getAdminText(subheader, pluginName))).append("</li>");

代码示例来源:origin: igniterealtime/Openfire

for (Element el = parent; el != null; el = el.getParent()) {
  final String defaultNS = el.getNamespaceForPrefix("").getURI();
  if (defaultNS.equals("")) {
parent = parent.getParent();

代码示例来源:origin: hibernate/hibernate-orm

);
final Element parentXmlMapping = xmlMapping.getParent();
final ComponentAuditingData auditData = new ComponentAuditingData();
final ReflectionManager reflectionManager = mainGenerator
    key ? xmlMapping : xmlMapping.getParent(),
    new PropertyAuditingData(
        prefix,

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

public void onEnd(ElementPath elementPath) {
  try {
    Element origElement = elementPath.getCurrent();
    Element currentParent = origElement.getParent();
        modifiedElement.setParent(origElement.getParent());
        modifiedElement.setDocument(origElement.getDocument());

代码示例来源:origin: stackoverflow.com

List<Element> elements = new ArrayList<Element>();

while (subchilditr.hasNext()) {
  Element subchild = (Element) subchilditr.next();
  if (subchild.getText().equalsIgnoreCase(text)) {
    elements.add(subchild);
  }
}

for (Element element : elements) {
  element.getParent().removeContent(element);
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

protected boolean isFormColumn(Element element) {
  return "column".equals(element.getName())
      && element.getParent() != null
      && Form.NAME.equals(element.getParent().getName());
}

代码示例来源:origin: com.haulmont.cuba/cuba-gui

protected String getParentDataContainer(Element element) {
    Element parent = element.getParent();
    while (parent != null) {
      if (layoutLoaderConfig.getLoader(parent.getName()) != null) {
        return parent.attributeValue("dataContainer");
      }
      parent = parent.getParent();
    }
    return null;
  }
}

代码示例来源:origin: org.opencms/opencms-core

/**
 * @see org.opencms.xml.types.I_CmsXmlContentValue#getXmlIndex()
 */
public int getXmlIndex() {
  if (m_xmlIndex < 0) {
    m_xmlIndex = m_element.getParent().elements(m_element.getQName()).indexOf(m_element);
  }
  return m_xmlIndex;
}

代码示例来源:origin: org.apache.archiva/archiva-dependency-tree-consumer

public boolean endVisit( DependencyNode node )
  {
    Element e = xmlNode.getParent();
    if ( !xmlNode.hasContent() )
    {
      e.remove( xmlNode );
    }
    xmlNode = e.getParent();
    return true;
  }
}

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

parent = parent.getParent();

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

parent = parent.getParent();

代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core

public Node detach() {
  Element parent = target().getParent();
  if (parent!=null) parent.remove(this);
  return target().detach();
}

代码示例来源:origin: dom4j/dom4j

protected void testElementClone(Element element) throws Exception {
    Element element2 = (Element) element.clone();

    assertTrue("Returned a new Element", element2 != element);
    assertNull("New element has no parent", element2.getParent());
    assertNull("New element has no Document", element2.getDocument());

    assertTrue("Element fragments are equal", comparator.compare(element,
        element2) == 0);
  }
}

相关文章

Element类方法