当前位置: 首页>>代码示例>>Java>>正文


Java Parent类代码示例

本文整理汇总了Java中org.jdom.Parent的典型用法代码示例。如果您正苦于以下问题:Java Parent类的具体用法?Java Parent怎么用?Java Parent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Parent类属于org.jdom包,在下文中一共展示了Parent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveURI

import org.jdom.Parent; //导入依赖的package包/类
/** Use xml:base attributes at feed and entry level to resolve relative links */
private String resolveURI(URL baseURI, Parent parent, String url) {
    url = (url.equals(".") || url.equals("./")) ? "" : url;
    if (isRelativeURI(url) && parent != null && parent instanceof Element) {
        Attribute baseAtt = ((Element)parent).getAttribute("base", Namespace.XML_NAMESPACE);
        String xmlBase = (baseAtt == null) ? "" : baseAtt.getValue();
        if (!isRelativeURI(xmlBase) && !xmlBase.endsWith("/")) {
            xmlBase = xmlBase.substring(0, xmlBase.lastIndexOf("/")+1);
        }
        return resolveURI(baseURI, parent.getParent(), xmlBase + url);
    } else if (isRelativeURI(url) && parent == null) {
        return baseURI + url;
    } else if (baseURI != null && url.startsWith("/")) {
        String hostURI = baseURI.getProtocol() + "://" + baseURI.getHost();
        if (baseURI.getPort() != baseURI.getDefaultPort()) {
            hostURI = hostURI + ":" + baseURI.getPort();
        }
        return hostURI + url;
    }
    return url;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:Atom10Parser.java

示例2: createTreeNode

import org.jdom.Parent; //导入依赖的package包/类
private XMLNode createTreeNode(Content content) {
	XMLNode node = new XMLNode(content);
	if (content instanceof Parent) {
		Parent parent = (Parent) content;
		for (Object child : parent.getContent()) {
			if (child instanceof Element)
				node.add(createTreeNode((Content) child));
			else if (textSizeLimit != 0 && child instanceof Text) {
				Text text = (Text) child;
				if (!text.getTextNormalize().isEmpty())
					node.add(createTreeNode(text));
			}
		}
	}
	return node;
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:17,代码来源:XMLTree.java

示例3: endElement

import org.jdom.Parent; //导入依赖的package包/类
/**
 * Indicates the end of an element
 * (<code>&lt;/[element name]&gt;</code>) is reached.  Note that
 * the parser does not distinguish between empty
 * elements and non-empty elements, so this will occur uniformly.
 *
 * @param namespaceURI <code>String</code> URI of namespace this
 *                     element is associated with
 * @param localName <code>String</code> name of element without prefix
 * @param qName <code>String</code> name of element in XML 1.0 form
 * @throws SAXException when things go wrong
 */
public void endElement(String namespaceURI, String localName,
                       String qName) throws SAXException {

    if (suppress) return;

    flushCharacters();

    if (!atRoot) {
        Parent p = currentElement.getParent();
        if (p instanceof Document) {
           atRoot = true;
        }
        else {
            currentElement = (Element) p;
        }
    }
    else {
        throw new SAXException(
            "Ill-formed XML document (missing opening tag for " +
            localName + ")");
    }
}
 
开发者ID:AMPBEdu,项目名称:gjOryx,代码行数:35,代码来源:SAXHandler.java

示例4: removeOldNodes

import org.jdom.Parent; //导入依赖的package包/类
/**
 * Method to determine if the navigation file has changed since it was last imported. If so then we need to check for old <items> and remove them from the document
 * 
 * @param items
 */
protected void removeOldNodes(final String[] items) {
    final Vector v = new Vector();
    final List itemList = getDocument().getRootElement().getChildren(ITEM_NODE);
    if (itemList != null && !itemList.isEmpty()) {
        final Iterator itemListElement = itemList.iterator();
        while (itemListElement.hasNext()) {
            final Element anItem = (Element) itemListElement.next();
            if (!doesItemExist(anItem.getAttributeValue(ITEM_IDENTIFIER), items)) {
                // mark this node - (can't delete at the same time as looping
                // otherwise get concurrent access errors)
                v.add(anItem);
            }
        }
        final Iterator itemsToRemove = v.iterator();
        while (itemsToRemove.hasNext()) {
            final Element anItemToDelete = (Element) itemsToRemove.next();
            final Parent parent = anItemToDelete.getParent();
            if (parent != null) {
                log.warn("item no longer exists so remove " + anItemToDelete.getAttributeValue(ITEM_IDENTIFIER), null);
                parent.removeContent(anItemToDelete);
            }
        }
    }
    v.clear();
}
 
开发者ID:huihoo,项目名称:olat,代码行数:31,代码来源:SequencerModel.java

示例5: removeByXpath

import org.jdom.Parent; //导入依赖的package包/类
public void removeByXpath(Set<String> toRemove) throws Exception {
	for (Iterator idIt = toRemove.iterator(); idIt.hasNext();) {
        String xpath = (String) idIt.next();
        Element element = null;
        element = getElementByXPath(xpath);
        if ( element != null ) {
            Parent p = element.getParent();
            p.removeContent(element);
        } else {
            log.debug("Could not find "+xpath);
        }

    }
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:15,代码来源:LASConfig.java

示例6: ShelveChangesManager

import org.jdom.Parent; //导入依赖的package包/类
public ShelveChangesManager(final Project project, final MessageBus bus) {
  super(project);
  myPathMacroSubstitutor = PathMacroManager.getInstance(myProject).createTrackingSubstitutor();
  myBus = bus;
  mySchemeManager =
    SchemesManagerFactory.getInstance(project).create(SHELVE_MANAGER_DIR_PATH, new SchemeProcessor<ShelvedChangeList>() {
      @Nullable
      @Override
      public ShelvedChangeList readScheme(@NotNull Element element) throws InvalidDataException {
        return readOneShelvedChangeList(element);
      }

      @Override
      public Parent writeScheme(@NotNull ShelvedChangeList scheme) throws WriteExternalException {
        Element child = new Element(ELEMENT_CHANGELIST);
        scheme.writeExternal(child);
        myPathMacroSubstitutor.collapsePaths(child);
        return child;
      }
    });
  File shelfDirectory = mySchemeManager.getRootDirectory();
  myFileProcessor = new CompoundShelfFileProcessor(shelfDirectory);
  // do not try to ignore when new project created,
  // because it may lead to predefined ignore creation conflict; see ConvertExcludedToIgnoredTest etc
  if (shelfDirectory.exists()) {
    ChangeListManager.getInstance(project).addDirectoryToIgnoreImplicitly(shelfDirectory.getAbsolutePath());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:ShelveChangesManager.java

示例7: generateForeignMarkup

import org.jdom.Parent; //导入依赖的package包/类
protected void generateForeignMarkup(Element e, List foreignMarkup) {
    if (foreignMarkup != null) {
        Iterator elems = (Iterator) foreignMarkup.iterator();
        while (elems.hasNext()) {
            Element elem = (Element) elems.next();
            Parent parent = elem.getParent();
            if (parent != null) {
                parent.removeContent(elem);
            }
            e.addContent(elem);
        }
    }
}
 
开发者ID:4thline,项目名称:feeds,代码行数:14,代码来源:BaseWireFeedGenerator.java

示例8: DescendantIterator

import org.jdom.Parent; //导入依赖的package包/类
/**
 * Iterator for the descendants of the supplied object.
 *
 * @param parent document or element whose descendants will be iterated
 */
DescendantIterator(Parent parent) {
    if (parent == null) {
        throw new IllegalArgumentException("parent parameter was null");
    }
    this.iterator = parent.getContent().iterator();
}
 
开发者ID:AMPBEdu,项目名称:gjOryx,代码行数:12,代码来源:DescendantIterator.java

示例9: save

import org.jdom.Parent; //导入依赖的package包/类
@Nullable
static VirtualFile save(@NotNull IFile file, Parent element, Object requestor) throws StateStorageException {
  try {
    VirtualFile vFile = LocalFileSystem.getInstance().findFileByIoFile(file);
    Pair<String, String> pair = loadFile(vFile);
    String text = JDOMUtil.writeParent(element, pair.second);

    if (file.exists()) {
      if (text.equals(pair.first)) {
        return null;
      }
    }
    else {
      file.createParentDirs();
    }

    // mark this action as modifying the file which daemon analyzer should ignore
    AccessToken token = ApplicationManager.getApplication().acquireWriteActionLock(DocumentRunnable.IgnoreDocumentRunnable.class);
    try {
      VirtualFile virtualFile = getOrCreateVirtualFile(requestor, file);
      byte[] bytes = text.getBytes(CharsetToolkit.UTF8);
      virtualFile.setBinaryContent(bytes, -1, -1, requestor);
      return virtualFile;
    }
    finally {
      token.finish();
    }
  }
  catch (IOException e) {
    throw new StateStorageException(e);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:33,代码来源:StorageUtil.java

示例10: isEmpty

import org.jdom.Parent; //导入依赖的package包/类
public static boolean isEmpty(@Nullable Parent element) {
  if (element == null) {
    return true;
  }
  else if (element instanceof Element) {
    return JDOMUtil.isEmpty((Element)element);
  }
  else {
    Document document = (Document)element;
    return !document.hasRootElement() || JDOMUtil.isEmpty(document.getRootElement());
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:StorageUtil.java

示例11: newContentIfDiffers

import org.jdom.Parent; //导入依赖的package包/类
@Nullable
public static BufferExposingByteArrayOutputStream newContentIfDiffers(@Nonnull Parent element, @Nullable VirtualFile file) {
  try {
    Pair<byte[], String> pair = loadFile(file);
    BufferExposingByteArrayOutputStream out = writeToBytes(element, pair.second);
    return pair.first != null && equal(pair.first, out) ? null : out;
  }
  catch (IOException e) {
    LOG.debug(e);
    return null;
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:StorageUtil.java

示例12: sendContent

import org.jdom.Parent; //导入依赖的package包/类
public static void sendContent(@Nonnull StreamProvider provider, @Nonnull String fileSpec, @Nonnull Parent element, @Nonnull RoamingType type) {
  if (!provider.isApplicable(fileSpec, type)) {
    return;
  }

  try {
    doSendContent(provider, fileSpec, element, type);
  }
  catch (IOException e) {
    LOG.warn(e);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:StorageUtil.java

示例13: writeScheme

import org.jdom.Parent; //导入依赖的package包/类
@Override
public Parent writeScheme(@Nonnull final ToolsGroup<T> scheme) throws WriteExternalException {
  Element groupElement = new Element(TOOL_SET);
  if (scheme.getName() != null) {
    groupElement.setAttribute(ATTRIBUTE_NAME, scheme.getName());
  }

  for (T tool : scheme.getElements()) {
    saveTool(tool, groupElement);
  }

  return groupElement;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:ToolsProcessor.java

示例14: writeToBytes

import org.jdom.Parent; //导入依赖的package包/类
@Nonnull
public static BufferExposingByteArrayOutputStream writeToBytes(@Nonnull Parent element, @Nonnull String lineSeparator) throws IOException {
  BufferExposingByteArrayOutputStream out = new BufferExposingByteArrayOutputStream(512);
  JDOMUtil.writeParent(element, out, lineSeparator);
  return out;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:7,代码来源:StorageUtil.java

示例15: elementToBytes

import org.jdom.Parent; //导入依赖的package包/类
@Nonnull
public static BufferExposingByteArrayOutputStream elementToBytes(@Nonnull Parent element, boolean useSystemLineSeparator) throws IOException {
  return writeToBytes(element, useSystemLineSeparator ? SystemProperties.getLineSeparator() : "\n");
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:StorageUtil.java


注:本文中的org.jdom.Parent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。