本文整理汇总了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;
}
示例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);
}