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


Java DefaultElement.selectSingleNode方法代码示例

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


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

示例1: parseSeedsFromXML

import org.dom4j.tree.DefaultElement; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private ReportSeedParsedVoCollection parseSeedsFromXML(String reportXML) throws DocumentException
{
	String searchFields;
	String displayFields;

	Document document = DocumentHelper.parseText(reportXML);

	ReportSeedParsedVoCollection seeds = new ReportSeedParsedVoCollection();
	List list = document.selectNodes("//Project/Seeds/Seed");
	for (Iterator iter = list.iterator(); iter.hasNext();)
	{
		DefaultElement attribute = (DefaultElement) iter.next();

		ReportSeedParsedVo seed = new ReportSeedParsedVo();
		seed.setName(attribute.valueOf("Name"));
		seed.setType(attribute.valueOf("Type"));
		seed.setBOName(attribute.valueOf("BOName"));
		seed.setBOField(attribute.valueOf("BOField"));
		seed.setCanBeNull(new Boolean(attribute.valueOf("CanBeNull").equalsIgnoreCase("true")));
		
		Node node = attribute.selectSingleNode("Searchable");
		if(node != null)
		{
			seed.setSearchType(node.valueOf("@type"));
		
			// Split 'Search By' fields by comma
			searchFields = node.valueOf("@by");
			
			String[] sf = searchFields.split(",");
			for (int  i = 0; i < sf.length; i++)
			{
				if (sf[i] != null)
					sf[i] = sf[i].trim();
			}
			seed.setSearchBy(sf);
			
			
			displayFields = node.valueOf("@display");
			
			String[] df = displayFields.split(",");
			for (int i = 0; i < df.length; i++)
			{
				if(df[i] != null)
					df[i] = df[i].trim();
			}
			seed.setDisplayFields(df);
		}
	
		seeds.add(seed);
	}

	return seeds;
}
 
开发者ID:oopcell,项目名称:AvoinApotti,代码行数:55,代码来源:Logic.java

示例2: parseSeedsFromXML

import org.dom4j.tree.DefaultElement; //导入方法依赖的package包/类
@SuppressWarnings({"rawtypes"})
private void parseSeedsFromXML(String reportXML) throws DocumentException
{
	String displayFields;
	String searchFields;
	
	Document document = DocumentHelper.parseText(reportXML);

	ReportSeedParsedVoCollection seeds = new ReportSeedParsedVoCollection();
	List list = document.selectNodes("//Project/Seeds/Seed");
	for (Iterator iter = list.iterator(); iter.hasNext();)
	{
		DefaultElement attribute = (DefaultElement) iter.next();

		ReportSeedParsedVo seed = new ReportSeedParsedVo();
		seed.setName(attribute.valueOf("Name"));
		seed.setType(attribute.valueOf("Type"));
		seed.setBOName(attribute.valueOf("BOName"));
		seed.setBOField(attribute.valueOf("BOField"));
		seed.setCanBeNull(new Boolean(attribute.valueOf("CanBeNull").equalsIgnoreCase("true")));
		
		//WDEV-12753
		Node node = attribute.selectSingleNode("Searchable");
		
		if(node != null)
		{
			seed.setSearchType(node.valueOf("@type"));
		
			// Split 'Search By' fields by comma
			searchFields = node.valueOf("@by");
			
			String[] sf = searchFields.split(",");
			for (int  i = 0; i < sf.length; i++)
			{
				if (sf[i] != null)
					sf[i] = sf[i].trim();
			}
			seed.setSearchBy(sf);
			
			
			displayFields = node.valueOf("@display");
			
			String[] df = displayFields.split(",");
			for (int i = 0; i < df.length; i++)
			{
				if(df[i] != null)
					df[i] = df[i].trim();
			}
			seed.setDisplayFields(df);
		}
		
		//System.out.println(java.util.Arrays.toString(df));
		
		seeds.add(seed);
	}

	form.getGlobalContext().Admin.setReportSeedParsed(seeds);
}
 
开发者ID:oopcell,项目名称:AvoinApotti,代码行数:59,代码来源:Logic.java


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