• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Parent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: doSendContent

import org.jdom.Parent; //导入依赖的package包/类
/**
 * You must call {@link StreamProvider#isApplicable(String, com.intellij.openapi.components.RoamingType)} before
 */
public static void doSendContent(@Nonnull StreamProvider provider, @Nonnull String fileSpec, @Nonnull Parent element, @Nonnull RoamingType type) throws IOException {
  // we should use standard line-separator (\n) - stream provider can share file content on any OS
  BufferExposingByteArrayOutputStream content = elementToBytes(element, false);
  provider.saveContent(fileSpec, content.getInternalBuffer(), content.size(), type);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:9,代码来源:StorageUtil.java


示例17: 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().createSchemesManager(SHELVE_MANAGER_DIR_PATH, new BaseSchemeProcessor<ShelvedChangeList>() {
    @Nullable
    @Override
    public ShelvedChangeList readScheme(@Nonnull Element element, boolean duringLoad) throws InvalidDataException {
      return readOneShelvedChangeList(element);
    }

    @Nonnull
    @Override
    public Parent writeScheme(@Nonnull ShelvedChangeList scheme) throws WriteExternalException {
      Element child = new Element(ELEMENT_CHANGELIST);
      scheme.writeExternal(child);
      myPathMacroSubstitutor.collapsePaths(child);
      return child;
    }
  }, RoamingType.PER_USER);

  myCleaningFuture = JobScheduler.getScheduler().scheduleWithFixedDelay(new Runnable() {
    @Override
    public void run() {
      cleanSystemUnshelvedOlderOneWeek();
    }
  }, 1, 1, TimeUnit.DAYS);
  Disposer.register(project, new Disposable() {
    @Override
    public void dispose() {
      stopCleanScheduler();
    }
  });

  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:consulo,项目名称:consulo,代码行数:43,代码来源:ShelveChangesManager.java


示例18: resolveURI

import org.jdom.Parent; //导入依赖的package包/类
/**
 * } 
 * Resolve URI based considering xml:base and baseURI.
 * @param baseURI Base URI of feed
 * @param parent  Parent from which to consider xml:base
 * @param url     URL to be resolved
 */
private String resolveURI(String baseURI, Parent parent, String url) {
    if (isRelativeURI(url)) {
        url = (!".".equals(url) && !"./".equals(url)) ? url : "";

        // Relative URI with parent
        if (parent != null && parent instanceof Element) {

            // Do we have an xml:base?         
            String xmlbase = ((Element)parent).getAttributeValue(
                "base", Namespace.XML_NAMESPACE);
            if (xmlbase != null && xmlbase.trim().length() > 0) {
                if (isAbsoluteURI(xmlbase)) {
                    // Absolute xml:base, so form URI right now 
                    if (url.startsWith("/")) { 
                        // Host relative URI
                        int slashslash = xmlbase.indexOf("//");
                        int nextslash = xmlbase.indexOf("/", slashslash + 2);
                        if (nextslash != -1) xmlbase = xmlbase.substring(0, nextslash);
                        return formURI(xmlbase, url); 
                    }
                    if (!xmlbase.endsWith("/")) {
                        // Base URI is filename, strip it off 
                        xmlbase = xmlbase.substring(0, xmlbase.lastIndexOf("/"));
                    }
                    return formURI(xmlbase, url);
                } else {
                    // Relative xml:base, so walk up tree
                    return resolveURI(baseURI, parent.getParent(), 
                        stripTrailingSlash(xmlbase) + "/"+ stripStartingSlash(url));
                }
            }
            // No xml:base so walk up tree
            return resolveURI(baseURI, parent.getParent(), url);

        // Relative URI with no parent (i.e. top of tree), so form URI right now
        } else if (parent == null || parent instanceof Document) {
            return formURI(baseURI, url);        
        } 
    }                
    return url;
}
 
开发者ID:Norkart,项目名称:NK-VirtualGlobe,代码行数:49,代码来源:Atom10Parser.java


示例19: writeScheme

import org.jdom.Parent; //导入依赖的package包/类
public abstract Parent writeScheme(@NotNull T scheme) throws WriteExternalException; 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:2,代码来源:SchemeProcessor.java


示例20: writeScheme

import org.jdom.Parent; //导入依赖的package包/类
Parent writeScheme(@Nonnull T scheme) throws WriteExternalException; 
开发者ID:consulo,项目名称:consulo,代码行数:2,代码来源:SchemeProcessor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EXTTextureFilterAnisotropic类代码示例发布时间:2022-05-22
下一篇:
Java VKApi类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap