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


Java HierarchicalStreamReader.getAttributeCount方法代码示例

本文整理汇总了Java中com.thoughtworks.xstream.io.HierarchicalStreamReader.getAttributeCount方法的典型用法代码示例。如果您正苦于以下问题:Java HierarchicalStreamReader.getAttributeCount方法的具体用法?Java HierarchicalStreamReader.getAttributeCount怎么用?Java HierarchicalStreamReader.getAttributeCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.thoughtworks.xstream.io.HierarchicalStreamReader的用法示例。


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

示例1: copy

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入方法依赖的package包/类
public void copy(HierarchicalStreamReader source, HierarchicalStreamWriter destination) {
    destination.startNode(source.getNodeName());
    int attributeCount = source.getAttributeCount();
    for (int i = 0; i < attributeCount; i++) {
        destination.addAttribute(source.getAttributeName(i), source.getAttribute(i));
    }
    String value = source.getValue();
    if (value != null && value.length() > 0) {
        destination.setValue(value);
    }
    while (source.hasMoreChildren()) {
        source.moveDown();
        copy(source, destination);
        source.moveUp();
    }
    destination.endNode();
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:HierarchicalStreamCopier.java

示例2: parseSubTree2

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入方法依赖的package包/类
private Element parseSubTree2(HierarchicalStreamReader reader, Document doc)
{
	String qname = reader.getNodeName();
	Element parent = doc.createElement(qname);

	// Iterator i = reader.getAttributeNames();
	int count = reader.getAttributeCount();
	for( int i = 0; i < count; i++ )
	{
		String aname = reader.getAttributeName(i);
		String value = reader.getAttribute(i);
		parent.setAttribute(aname, value);
	}

	String text = reader.getValue();
	if( text.trim().length() != 0 )
	{
		Text textEl = doc.createTextNode(text);
		parent.appendChild(textEl);
	}

	for( ; reader.hasMoreChildren(); reader.moveUp() )
	{
		reader.moveDown();
		Element child = parseSubTree2(reader, doc);
		parent.appendChild(child);
	}

	return parent;
}
 
开发者ID:equella,项目名称:Equella,代码行数:31,代码来源:OAIDOMConverter.java

示例3: unmarshallElement

import com.thoughtworks.xstream.io.HierarchicalStreamReader; //导入方法依赖的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


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