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


Java Branch类代码示例

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


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

示例1: toElement

import org.dom4j.Branch; //导入依赖的package包/类
/**
 * Convert to an XML element.
 */
public Element toElement(Branch parent) {
	Element root = parent.addElement("FindBugsSummary");
	DateFormat df = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss Z");
	Date date = new Date();
	root.addAttribute("timestamp", df.format(date));
	root.addAttribute("total_classes", String.valueOf(totalClasses));
	root.addAttribute("total_bugs", String.valueOf(totalErrors));
	root.addAttribute("num_packages", String.valueOf(packageStatsMap.size()));

	Iterator<PackageStats> i = packageStatsMap.values().iterator();
	while (i.hasNext()) {
		PackageStats stats = i.next();
		stats.toElement(root);
	}

	return root;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:ProjectStats.java

示例2: createNode

import org.dom4j.Branch; //导入依赖的package包/类
@Override
protected Object createNode(final String name) {
    final Element element = documentFactory.createElement(encodeNode(name));
    final Branch top = top();
    if (top != null) {
        top().add(element);
    }
    return element;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:Dom4JWriter.java

示例3: unmarshallElement

import org.dom4j.Branch; //导入依赖的package包/类
private void unmarshallElement(HierarchicalStreamReader reader, Branch branch) {
	Element element = branch.addElement(reader.getNodeName());
	for (int i=0; i<reader.getAttributeCount(); i++) {
		String attributeName = reader.getAttributeName(i);
		String attributeValue = reader.getAttribute(i);
		element.addAttribute(attributeName, attributeValue);
	}
	if (StringUtils.isNotBlank(reader.getValue()))
		element.setText(reader.getValue().trim());
	while (reader.hasMoreChildren()) {
		reader.moveDown();
		unmarshallElement(reader, element);
		reader.moveUp();
	}
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:16,代码来源:JpaConverter.java

示例4: openTag

import org.dom4j.Branch; //导入依赖的package包/类
public void openTag(String tagName, XMLAttributeList attributeList) {
	Branch top = stack.getLast();
	Element element = top.addElement(tagName);
	stack.addLast(element);

	for (Iterator<XMLAttributeList.NameValuePair> i= attributeList.iterator();
		i.hasNext(); ) {
		XMLAttributeList.NameValuePair pair = i.next();
		element.addAttribute(pair.getName(), pair.getValue());
	}
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:Dom4JXMLOutput.java

示例5: evaluate

import org.dom4j.Branch; //导入依赖的package包/类
public Object evaluate(TaskRequest req, TaskResponse res) {

		Branch rslt = new DocumentFactory().createDocument();
		if (name != null) {
			rslt = rslt.addElement((String) name.evaluate(req, res));
		}
		return rslt;
		
	}
 
开发者ID:drewwills,项目名称:cernunnos,代码行数:10,代码来源:NewDocumentPhrase.java

示例6: getChildAxisIterator

import org.dom4j.Branch; //导入依赖的package包/类
public Iterator getChildAxisIterator(Object contextNode)
{
    Iterator result = null;
    if ( contextNode instanceof Branch )
    {
        Branch node = (Branch) contextNode;
        result = node.nodeIterator();
    }
    if (result != null) {
        return result;
    }
    return JaxenConstants.EMPTY_ITERATOR;
}
 
开发者ID:jaxen-xpath,项目名称:jaxen,代码行数:14,代码来源:DocumentNavigator.java

示例7: openTag

import org.dom4j.Branch; //导入依赖的package包/类
public void openTag(String tagName, XMLAttributeList attributeList) {
    Branch top = stack.getLast();
    Element element = top.addElement(tagName);
    stack.addLast(element);

    for (Iterator<XMLAttributeList.NameValuePair> i = attributeList.iterator(); i.hasNext();) {
        XMLAttributeList.NameValuePair pair = i.next();
        element.addAttribute(pair.getName(), pair.getValue());
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:11,代码来源:Dom4JXMLOutput.java

示例8: writeValue

import org.dom4j.Branch; //导入依赖的package包/类
private void writeValue(final Branch branch, final Object obj, final String key, final String sValue, final boolean asAttribute,
    final boolean asCDATA)
{
  if (sValue == null) {
    return;
  }
  if (asAttribute == true) {
    addAttribute((Element) branch, obj, key, sValue);
  } else if (asCDATA == true) {
    branch.addElement(key).add(new DefaultCDATA(sValue));
  } else {
    branch.addElement(key).setText(sValue);
  }
}
 
开发者ID:micromata,项目名称:projectforge-webapp,代码行数:15,代码来源:XmlObjectWriter.java

示例9: visit

import org.dom4j.Branch; //导入依赖的package包/类
/**
 * entry method
 * 
 * @param obj
 * @param name
 */
public void visit(_Object obj, String name) {
	Field field = new Field(name, false);
	field.setTarget(obj);

	Branch branch = document;

	VisitorContext childCtx = new VisitorContext();
	childCtx.setField(field);
	childCtx.setBranch(branch);

	push(childCtx);

	obj.accept(this);
}
 
开发者ID:jackhatedance,项目名称:visual-programming,代码行数:21,代码来源:XmlSerialzationVisitor.java

示例10: updateCollectionRecord

import org.dom4j.Branch; //导入依赖的package包/类
/**
 *  Updates a collection record Document.
 *
 * @param  collectionRecordDoc  A collection record Document (may be from the template)
 * @param  title                Title (must not be null)
 * @param  description          Description (can be null)
 * @param  additionalMetadata   Additional metadata (String, XML, or null)
 * @param  xmlFormat            Format specifier or "DDS_UNCHANGED" to leave unchanged
 * @param  key                  Collection key or "DDS_UNCHANGED" to leave unchanged
 * @param  id                   Record ID or "DDS_UNCHANGED" to leave unchanged
 * @param  accessionDate        Accession date or null to leave unchanged
 * @return                      An updated Document
 * @exception  Exception        If error
 */
private org.dom4j.Document updateCollectionRecord(
                                                  org.dom4j.Document collectionRecordDoc,
                                                  String title,
                                                  String description,
                                                  String additionalMetadata,
                                                  String xmlFormat,
                                                  String key,
                                                  String id,
                                                  Date accessionDate) throws Exception {

	if (!key.equals("DDS_UNCHANGED"))
		collectionRecordDoc.selectSingleNode("/*[local-name()='collectionRecord']/*[local-name()='access']/*[local-name()='key']").setText(key);

	if (!xmlFormat.equals("DDS_UNCHANGED"))
		collectionRecordDoc.selectSingleNode("/*[local-name()='collectionRecord']/*[local-name()='access']/*[local-name()='key']/@libraryFormat").setText(xmlFormat);

	if (!id.equals("DDS_UNCHANGED"))
		collectionRecordDoc.selectSingleNode("/*[local-name()='collectionRecord']/*[local-name()='metaMetadata']/*[local-name()='catalogEntries']/*[local-name()='catalog']/@entry").setText(id);

	if (accessionDate != null)
		collectionRecordDoc.selectSingleNode("/*[local-name()='collectionRecord']/*[local-name()='approval']/*[local-name()='collectionStatuses']/*[local-name()='collectionStatus']/@date").setText(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(accessionDate));

	// Update the short title:
	Node shortTitleNode = collectionRecordDoc.selectSingleNode("/*[local-name()='collectionRecord']/*[local-name()='general']/*[local-name()='shortTitle']");
	if (shortTitleNode != null)
		shortTitleNode.setText(title);

	// For previous repositories that are upgraded, remove the fullTitle (legacy)
	Node fullTitleNode = collectionRecordDoc.selectSingleNode("/*[local-name()='collectionRecord']/*[local-name()='general']/*[local-name()='fullTitle']");
	if (fullTitleNode != null)
		fullTitleNode.detach();

	Node descriptionNode = collectionRecordDoc.selectSingleNode("/*[local-name()='collectionRecord']/*[local-name()='general']/*[local-name()='description']");
	if (descriptionNode == null)
		descriptionNode = ((Branch) collectionRecordDoc.selectSingleNode("/*[local-name()='collectionRecord']/*[local-name()='general']")).addElement("description");

	if (description == null || description.trim().length() == 0)
		description = title;
	descriptionNode.setText(description);

	// Delete and then re-create the additionalMetadata node:
	Node additionalMetadataNode = collectionRecordDoc.selectSingleNode("/*[local-name()='collectionRecord']/*[local-name()='additionalMetadata']");
	if (additionalMetadataNode != null)
		additionalMetadataNode.detach();

	if (additionalMetadata != null && additionalMetadata.trim().length() > 0) {
		org.dom4j.Document additionalMetadataDocument;
		try {
			additionalMetadataDocument = Dom4jUtils.getXmlDocument("<additionalMetadata>" + additionalMetadata + "</additionalMetadata>");
		} catch (Throwable t) {
			throw new PutCollectionException("Error processing additionalMetadata argument: " + t.getMessage(), PutCollectionException.ERROR_CODE_BAD_ADDITIONAL_METADATA);
		}
		((Branch) collectionRecordDoc.selectSingleNode("/*[local-name()='collectionRecord']")).add(additionalMetadataDocument.getRootElement());
	}

	return collectionRecordDoc;
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:72,代码来源:RepositoryManager.java

示例11: Dom4JWriter

import org.dom4j.Branch; //导入依赖的package包/类
/**
 * @since 1.4
 */
public Dom4JWriter(final Branch root, final DocumentFactory factory, final NameCoder nameCoder) {
    super(root, nameCoder);
    documentFactory = factory;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:Dom4JWriter.java

示例12: top

import org.dom4j.Branch; //导入依赖的package包/类
private Branch top() {
    return (Branch)getCurrent();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:Dom4JWriter.java

示例13: appendContent

import org.dom4j.Branch; //导入依赖的package包/类
public void appendContent(Branch branch) {
	element.appendContent( branch );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:4,代码来源:ElementWrapper.java

示例14: appendContent

import org.dom4j.Branch; //导入依赖的package包/类
public void appendContent(Branch branch) {
	getWrapped().appendContent(branch);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:4,代码来源:VersionedDocument.java

示例15: toElement

import org.dom4j.Branch; //导入依赖的package包/类
private void toElement(XMLWriteable obj, Branch parent) {
	Dom4JXMLOutput treeBuilder = new Dom4JXMLOutput(parent);
	treeBuilder.write(obj);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:5,代码来源:PackageStats.java


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