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


Java Content类代码示例

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


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

示例1: updateElement

import org.jdom.Content; //导入依赖的package包/类
/**
 * Method updateElement.
 * 
 * @param counter
 * @param shouldExist
 * @param name
 * @param parent
 * @return Element
 */
protected Element updateElement(Counter counter, Element parent, String name, boolean shouldExist)
{
    Element element =  parent.getChild(name, parent.getNamespace());
    if (element != null && shouldExist) {
        counter.increaseCount();
    }
    if (element == null && shouldExist) {
        element = factory.element(name, parent.getNamespace());
        insertAtPreferredLocation(parent, element, counter);
        counter.increaseCount();
    }
    if (!shouldExist && element != null) {
        int index = parent.indexOf(element);
        if (index > 0) {
            Content previous = parent.getContent(index - 1);
            if (previous instanceof Text) {
                Text txt = (Text)previous;
                if (txt.getTextTrim().length() == 0) {
                    parent.removeContent(txt);
                }
            }
        }
        parent.removeContent(element);
    }
    return element;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:36,代码来源:NetbeansBuildActionJDOMWriter.java

示例2: updateElement

import org.jdom.Content; //导入依赖的package包/类
/**
 * Method updateElement
 *
 * @param counter
 * @param shouldExist
 * @param name
 * @param parent
 */
protected Element updateElement( Counter counter, Element parent, String name, boolean shouldExist )
{
    Element element = parent.getChild( name, parent.getNamespace() );
    if ( element != null && shouldExist )
    {
        counter.increaseCount();
    }
    if ( element == null && shouldExist )
    {
        element = factory.element( name, parent.getNamespace() );
        insertAtPreferredLocation( parent, element, counter );
        counter.increaseCount();
    }
    if ( !shouldExist && element != null )
    {
        int index = parent.indexOf( element );
        if ( index > 0 )
        {
            Content previous = parent.getContent( index - 1 );
            if ( previous instanceof Text )
            {
                Text txt = (Text) previous;
                if ( txt.getTextTrim().length() == 0 )
                {
                    parent.removeContent( txt );
                }
            }
        }
        parent.removeContent( element );
    }
    return element;
}
 
开发者ID:javiersigler,项目名称:apache-maven-shade-plugin,代码行数:41,代码来源:MavenJDOMWriter.java

示例3: parseElement

import org.jdom.Content; //导入依赖的package包/类
private void parseElement(Element elt, boolean parseLink) {
	if ("content".equals(elt.getName()) && "media".equals(elt.getNamespacePrefix())) {
		if (parseLink) {
			tempItemLink = elt.getAttribute("url").getValue();
		}
		List<Content> subElts = elt.getContent();
		for (Content subelt : subElts) {
			if (subelt instanceof Element) {
				parseElement((Element) subelt, false);
			}
		}
	}
	if ("thumbnail".equals(elt.getName()) && "media".equals(elt.getNamespacePrefix())
			&& tempItemThumbURL == null) {
		tempItemThumbURL = elt.getAttribute("url").getValue();
	}
	if ("image".equals(elt.getName()) && "exInfo".equals(elt.getNamespacePrefix())
			&& tempItemThumbURL == null) {
		tempItemThumbURL = elt.getValue();
	}
}
 
开发者ID:DigitalMediaServer,项目名称:DigitalMediaServer,代码行数:22,代码来源:Feed.java

示例4: loadState

import org.jdom.Content; //导入依赖的package包/类
@Override
public void loadState(Element element) {
    if (ELEMENT_ROOT_ITEM_NAME.equals(element.getName())) {
        Iterator<Content> iterator = element.getDescendants();
        while (iterator.hasNext()) {
            Object content = iterator.next();
            if (!(content instanceof Element)) {
                continue;
            }
            Element e = (Element) content;
            if (ELEMENT_NAME_URL.equals(e.getName())) {
                url = e.getText();
            } else if (ELEMENT_NAME_MODULE.equals(e.getName())) {
                module = e.getText();
            } else if (ELEMENT_NAME_PATH.equals(e.getName())) {
                path = e.getText();
            } else if (ELEMENT_NAME_PARAM.equals(e.getName())) {
                String key = e.getAttributeValue(ATTRIBUTE_NAME_KEY);
                String value = e.getAttributeValue(ATTRIBUTE_NAME_VAL);
                params.put(key, value);
            }
        }
    }
}
 
开发者ID:FingerArt,项目名称:Open-Uploader,代码行数:25,代码来源:StateProjectComponent.java

示例5: updateBiopax

import org.jdom.Content; //导入依赖的package包/类
protected void updateBiopax(PathwayElement o, Element e) throws ConverterException
{
	Document bp = ((BiopaxElement)o).getBiopax();
	if(e != null && bp != null) {
		List<Content> content = bp.getRootElement().cloneContent();
		for(Content c : content) {
			if(c instanceof Element) {
				Element elm = (Element)c;
				if(elm.getNamespace().equals(GpmlFormat.BIOPAX)) {
					e.addContent(c);
				} else if(elm.getName().equals("RDF") && elm.getNamespace().equals(GpmlFormat.RDF)) {
					for(Object ce : elm.getChildren()) {
						if(((Element)ce).getNamespace().equals(GpmlFormat.BIOPAX)) {
							e.addContent((Element)ce);
						}
					}
				} else {
					Logger.log.info("Skipped non-biopax element" + c);
				}
			}
		}
	}
}
 
开发者ID:PathVisio,项目名称:pathvisio,代码行数:24,代码来源:GpmlFormatAbstract.java

示例6: getTextValue

import org.jdom.Content; //导入依赖的package包/类
@NotNull
static String getTextValue(@NotNull Element element, @NotNull String defaultText) {
  List<Content> content = element.getContent();
  int size = content.size();
  StringBuilder builder = null;
  for (int i = 0; i < size; i++) {
    Content child = content.get(i);
    if (child instanceof Text) {
      String value = child.getValue();
      if (builder == null && i == (size - 1)) {
        return value;
      }

      if (builder == null) {
        builder = new StringBuilder();
      }
      builder.append(value);
    }
  }
  return builder == null ? defaultText : builder.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:XmlSerializerImpl.java

示例7: serializeKeyOrValue

import org.jdom.Content; //导入依赖的package包/类
private void serializeKeyOrValue(@NotNull Element entry, @NotNull String attributeName, @Nullable Object value, @Nullable Binding binding, @NotNull SerializationFilter filter) {
  if (value == null) {
    return;
  }

  if (binding == null) {
    entry.setAttribute(attributeName, XmlSerializerImpl.convertToString(value));
  }
  else {
    Object serialized = binding.serialize(value, entry, filter);
    if (serialized != null) {
      if (myMapAnnotation != null && !myMapAnnotation.surroundKeyWithTag()) {
        entry.addContent((Content)serialized);
      }
      else {
        Element container = new Element(attributeName);
        container.addContent((Content)serialized);
        entry.addContent(container);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:MapBinding.java

示例8: createWrappedStructure

import org.jdom.Content; //导入依赖的package包/类
/** Traverses the initial xml element wrapper and builds hierarchy */
protected void createWrappedStructure(final WrapperFactory factory) {
    HierarchyWrapper currentWrapper = null;
    for (Content child : castToContentList(elementContent)) {
        Wrapper<?> wrapper = factory.create(child);
        if (wrapper instanceof SingleNewlineInTextWrapper) {
            continue;
        }
        if (currentWrapper == null) {
            currentWrapper = new HierarchyWrapper(wrapper);
            children.add(currentWrapper);
        } else {
            currentWrapper.addContent(wrapper);
        }
        if (currentWrapper.containsElement()) {
            currentWrapper.createWrappedStructure(factory);
            currentWrapper = null;
        }
    }
}
 
开发者ID:Ekryd,项目名称:sortpom,代码行数:21,代码来源:HierarchyWrapper.java

示例9: createTreeNode

import org.jdom.Content; //导入依赖的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

示例10: stripEmptyElements

import org.jdom.Content; //导入依赖的package包/类
private static void stripEmptyElements(Element asXML) {
	int childCount = asXML.getContent().size();
	int index = 0;
	while (index < childCount) {
		Content child = asXML.getContent(index);
		if (child instanceof Element) {
			Element childElement = (Element) child;
			if (childElement.getName().equals("port")) {
				index++;
			} else if (childElement.getDescendants(new ElementFilter("port")).hasNext()) {
				stripEmptyElements(childElement);
				index++;
			} else {
				asXML.removeContent(childElement);
				childCount--;
			}
		}
	}
}
 
开发者ID:apache,项目名称:incubator-taverna-workbench,代码行数:20,代码来源:IterationStrategyContextualView.java

示例11: encodeXML

import org.jdom.Content; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (index == null) {
        LOGGER.warn(" index not set");
        throw new MissingParameterException(" index not set");
    } else {
        element.addContent(index.encodeXML("Index", ns));
    }

    if (transmitPowerValue == null) {
        LOGGER.warn(" transmitPowerValue not set");
        throw new MissingParameterException(" transmitPowerValue not set");
    } else {
        element.addContent(transmitPowerValue.encodeXML(
                "TransmitPowerValue", ns));
    }

    //parameters
    return element;
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:28,代码来源:TransmitPowerLevelTableEntry.java

示例12: encodeXML

import org.jdom.Content; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (inventoryParameterSpecID == null) {
        LOGGER.warn(" inventoryParameterSpecID not set");
        throw new MissingParameterException(
            " inventoryParameterSpecID not set");
    } else {
        element.addContent(inventoryParameterSpecID.encodeXML(
                "InventoryParameterSpecID", ns));
    }

    //parameters
    return element;
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:22,代码来源:InventoryParameterSpecID.java

示例13: encodeXML

import org.jdom.Content; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (result == null) {
        LOGGER.warn(" result not set");
        throw new MissingParameterException(" result not set");
    } else {
        element.addContent(result.encodeXML("Result", ns));
    }

    if (opSpecID == null) {
        LOGGER.warn(" opSpecID not set");
        throw new MissingParameterException(" opSpecID not set");
    } else {
        element.addContent(opSpecID.encodeXML("OpSpecID", ns));
    }

    //parameters
    return element;
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:27,代码来源:C1G2BlockEraseOpSpecResult.java

示例14: encodeXML

import org.jdom.Content; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (gPOPortNumber == null) {
        LOGGER.warn(" gPOPortNumber not set");
        throw new MissingParameterException(" gPOPortNumber not set");
    } else {
        element.addContent(gPOPortNumber.encodeXML("GPOPortNumber", ns));
    }

    if (gPOData == null) {
        LOGGER.warn(" gPOData not set");
        throw new MissingParameterException(" gPOData not set");
    } else {
        element.addContent(gPOData.encodeXML("GPOData", ns));
    }

    //element.addContent(reserved0.encodeXML("reserved",ns));
    //parameters
    return element;
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:28,代码来源:GPOWriteData.java

示例15: encodeXML

import org.jdom.Content; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public Content encodeXML(String name, Namespace ns) {
    // element in namespace defined by parent element
    Element element = new Element(name, ns);
    // child element are always in default LLRP namespace
    ns = Namespace.getNamespace("llrp", LLRPConstants.LLRPNAMESPACE);

    if (modeIndex == null) {
        LOGGER.warn(" modeIndex not set");
        throw new MissingParameterException(" modeIndex not set");
    } else {
        element.addContent(modeIndex.encodeXML("ModeIndex", ns));
    }

    if (tari == null) {
        LOGGER.warn(" tari not set");
        throw new MissingParameterException(" tari not set");
    } else {
        element.addContent(tari.encodeXML("Tari", ns));
    }

    //parameters
    return element;
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:27,代码来源:C1G2RFControl.java


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