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


Java Element.getText方法代码示例

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


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

示例1: getGradeRanges

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *  we want to collect all the gradeRange Values and return them as an Array
 *
 *@return                The gradeRanges value
 *@exception  Exception  Description of the Exception
 */
public String[] getGradeRanges()
	throws Exception {
	List list = docMap.selectNodes(gradeRangeXPath);

	// create a normalized list, gr
	ArrayList gr = new ArrayList();
	for (Iterator i = list.iterator(); i.hasNext(); ) {
		Element e = (Element) i.next();
		String val = e.getText();
		if (!val.trim().equals("")) {
			gr.add(val);
		}
	}
	// now return a string array
	return (String[]) gr.toArray(new String[]{});
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:23,代码来源:ResourceRecord.java

示例2: parseOozieEdge

import org.dom4j.Element; //导入方法依赖的package包/类
/** Parse a edge from xml
 * @param enode  edge node
 */
private static OozieEdge parseOozieEdge(Element enode) {

	String src = "";
	String dst = "";
	List<Element> children = enode.elements();
	for( Element child: children){
		if ("source".equals(child.getName())) {
			src = child.getText();
		} else if ("destination".equals(child.getName())) {
			dst = child.getText();
			break;
		}
	}
	if (src.isEmpty() || dst.isEmpty()) {
		logger.warning("Empty edge, src:" + src + ", dst:" + dst);
		return null;
	}
	else{
		OozieEdge edge = new OozieEdge();
		edge.init(src, dst);
		return edge;
	}
}
 
开发者ID:ICT-BDA,项目名称:EasyML,代码行数:27,代码来源:OozieGraphXMLParser.java

示例3: parseDatasetNode

import org.dom4j.Element; //导入方法依赖的package包/类
/** parse a dataset node from xml */
private static OozieDatasetNode parseDatasetNode(Element xml_node) {
	List<Element> childNodes = xml_node.elements();
	OozieDatasetNode node = new OozieDatasetNode();

	for( Element child : childNodes){
		String value = child.getText();
		String name = child.getName();

		if ("id".equals(name))
			node.setId(value);
		else if ("moduleId".equals(name))
			node.setModuleId(value);
		else if ("x".equals(name))
			node.setX((int) Float.parseFloat(value));
		else if ("y".equals(name))
			node.setY((int) Float.parseFloat(value));
		else if ("file".equals(name))
			node.setFile(value);
	}

	return node;
}
 
开发者ID:ICT-BDA,项目名称:EasyML,代码行数:24,代码来源:OozieGraphXMLParser.java

示例4: getSubselect

import org.dom4j.Element; //导入方法依赖的package包/类
private static String getSubselect(Element element) {
	String subselect = element.attributeValue( "subselect" );
	if ( subselect != null ) {
		return subselect;
	}
	else {
		Element subselectElement = element.element( "subselect" );
		return subselectElement == null ? null : subselectElement.getText();
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:HbmBinder.java

示例5: getMirrorUrls

import org.dom4j.Element; //导入方法依赖的package包/类
public List getMirrorUrls () {
	String xpath = "/itemRecord/technical/online/mirrorURLs/mirrorURL";
	List nodes = getElements (xpath);
	
	List mirrorUrls = new ArrayList ();
	
	for (Iterator i=nodes.iterator();i.hasNext();) {
		Element mElement = (Element)i.next();
		String url = mElement.getText();
		if (url != null && url.trim().length() > 0)
			mirrorUrls.add (url.trim());
	}
	// return (String []) mirrorUrls.toArray(new String [] {});
	return mirrorUrls;
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:16,代码来源:ADNItemDocReader.java

示例6: parse

import org.dom4j.Element; //导入方法依赖的package包/类
@Override
public Value parse(Element element) {
	SlashValue value=new SlashValue();
	List<Slash> slashes=new ArrayList<Slash>();
	value.setSlashes(slashes);
	for(Object obj:element.elements()){
		if(obj==null || !(obj instanceof Element)){
			continue;
		}
		Element ele=(Element)obj;
		if(ele.getName().equals("slash")){
			Slash slash=new Slash();
			slashes.add(slash);
			slash.setDegree(Integer.valueOf(ele.attributeValue("degree")));
			slash.setX(Integer.valueOf(ele.attributeValue("x")));
			slash.setY(Integer.valueOf(ele.attributeValue("y")));
			slash.setText(ele.attributeValue("text"));				
		}else if(ele.getName().equals("base64-data")){
			String prefix="data:image/png;base64,";
			String base64Data=ele.getText();
			if(base64Data.startsWith(prefix)){
				base64Data=base64Data.substring(prefix.length(),base64Data.length());
			}
			value.setBase64Data(base64Data);
		}
	}
	return value;
}
 
开发者ID:youseries,项目名称:ureport,代码行数:29,代码来源:SlashValueParser.java

示例7: RemoteResultDoc

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *  Construct a RemoteResultDoc from a MatchingRecord element (of the reponse
 *  from the UrlCheck Web Service)
 *
 *@param  record  matching record {@link org.dom4j.Element}
 *@param  rs      instance of {@link RemoteSearcher}
 */
public RemoteResultDoc(Element record, RemoteSearcher rs) {
	// prtln ("constructor with element:\n\t " + e.asXML());
	this.rs = rs;
	url = record.element("url").getText();
	Element head = record.element("head");
	try {
		Element collectionElement = (Element) head.selectSingleNode("collection");
		collection = collectionElement.getText();
		id = head.selectSingleNode("id").getText();
	} catch (Throwable te) {
		prtln("RemoteResultDoc unable to parse element: " + te.getMessage());
	}
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:21,代码来源:RemoteResultDoc.java

示例8: SchemaPath

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *  Constructor for the SchemaPath object
 *
 *@param  e  Description of the Parameter
 */
public SchemaPath(Element e) {
	// prtln ("SchemaPath with \n" + e.asXML());
	xpath = e.getText();
	pathName = e.attributeValue("pathName");
	defaultValue = e.attributeValue("defaultValue");
	valueType = e.attributeValue("valueType");
	inputHelper = e.attributeValue("inputHelper");
	initialFieldCollapse = e.attributeValue("initialFieldCollapse");
	String copyRecord = e.attributeValue("requiredByCopyRecord");
	if (copyRecord != null && copyRecord.equals("true")) {
		requiredByCopyRecord = true;
	}

	String minimalRecord = e.attributeValue("requiredByMinimalRecord");
	if (minimalRecord != null && minimalRecord.equals("true")) {
		requiredByMinimalRecord = true;
	}

	String ro = e.attributeValue("readOnly");
	if (ro != null && ro.equals("true")) {
		readOnly = true;
	}
	
	String maxLenStr = e.attributeValue("maxLen");
	if (maxLenStr != null) {
		try {
			maxLen = Integer.parseInt(maxLenStr);
		} catch (NumberFormatException nfe) {
			prtln ("WARNING: could not parse \"" + maxLenStr + "\" as an integer");
		}
	}
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:38,代码来源:SchemaPath.java

示例9: getPartOfDRC

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *  Gets whether the collection is part of the DRC [true|false].
 *
 * @return                The partOfDRC Value
 * @exception  Exception  If error
 */
protected String getPartOfDRC() throws Exception {
	List nodes = getDom4jDoc().selectNodes("/*[local-name()='collectionRecord']/*[local-name()='access']/*[local-name()='drc']");
	if (nodes.size() != 1)
		return "false";
	Element element = (Element) nodes.get(0);
	return element.getText();
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:14,代码来源:DleseCollectionFileIndexingWriter.java

示例10: getUrls

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *  Gets the URL to the collection.
 *
 * @return                The collectionUrl value
 * @exception  Exception  If error
 */
public String[] getUrls() throws Exception {
	List nodes = getDom4jDoc().selectNodes("/*[local-name()='collectionRecord']/*[local-name()='access']/*[local-name()='collectionLocation']");
	if (nodes.size() == 0)
		return null;
	Element element = (Element) nodes.get(0);
	return new String[]{element.getText()};
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:14,代码来源:DleseCollectionFileIndexingWriter.java

示例11: isEmpty

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *  isEmpty returns true if neither the element, or any children recursively, have textual content or have a
 *  non-empty attribute.
 *
 * @param  e                 an Element to test
 * @param  ignoreWhiteSpace  determines whether whitespace is considered as textual content .
 * @return                   true if Element and all children recursively are empty
 */
public static boolean isEmpty(Element e, boolean ignoreWhiteSpace) {
	String t = e.getText();
	// if ((t == null) || (t.trim().length() > 0)) {

	// 02/28/07 no longer ignore whitespace!
	if (ignoreWhiteSpace && t.trim().length() > 0) {
		return false;
	}
	if (!ignoreWhiteSpace && t.length() > 0) {
		return false;
	}

	// is there a non-empty attribute? (note: we don't ignore whitespace for attributes ...)
	for (Iterator i = e.attributeIterator(); i.hasNext(); ) {
		Attribute a = (Attribute) i.next();
		String value = a.getValue();
		if ((value == null) || (value.trim().length() > 0)) {
			return false;
		}
	}

	// is there a non-empty child element?
	for (Iterator i = e.elementIterator(); i.hasNext(); ) {
		Element child = (Element) i.next();
		boolean isChildEmpty = isEmpty(child);
		if (!isChildEmpty) {
			return false;
		}
	}

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

示例12: getTitle

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *  Returns the title for the collection.
 *
 * @return                The title value
 * @exception  Exception  If error reading XML.
 */
public String getTitle() throws Exception {
	List nodes = getDom4jDoc().selectNodes("/record/general/title");
	if (nodes.size() == 0)
		return "";
	Element element = (Element) nodes.get(0);
	return element.getText();
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:14,代码来源:NCSCollectionFileIndexingWriter.java

示例13: parseChangeLog

import org.dom4j.Element; //导入方法依赖的package包/类
public List parseChangeLog(final File logFile) throws MalformedURLException, DocumentException {
    final List result = new ArrayList(11);
    final SAXReader saxReader = new SAXReader();
    final Document document = saxReader.read(logFile);
    final Element rootElement = document.getRootElement();
//    if (LOG.isDebugEnabled()) {
//      LOG.debug("rootElement: " + rootElement);
//    }
    // Iterate transactions
    int changeListCounter = 0;
    final Iterator iter = rootElement.elementIterator();
    while (iter.hasNext() && changeListCounter++ < maxChangeLists) {
      final Element transactionElement = (Element) iter.next();
      if (!transactionElement.getName().equals("transaction")) {
        continue;
      }
//      if (LOG.isDebugEnabled()) {
//        LOG.debug("transactionElement: " + transactionElement);
//      }
      // Create change list
      final String type = transactionElement.attributeValue("type");
      final byte changeType = toChangeType(type);
      if (changeType == Change.TYPE_UNKNOWN) {
        continue;
      }
      final String id = transactionElement.attributeValue("id");
      final String time = transactionElement.attributeValue("time");
      final String user = transactionElement.attributeValue("user");
      final Element elementComment = transactionElement.element("comment");
      final String comment = elementComment.getText();
      final ChangeList changeList = new ChangeList();
      changeList.setCreatedAt(new Date(Long.parseLong(time) * 1000L));
      changeList.setDescription(comment);
      changeList.setNumber(id);
      changeList.setUser(user);
      // Iterate versions
      int changeCounter = 0;
      final Set changes = new HashSet(11);
      final Iterator versionIter = transactionElement.elementIterator("version");
      while (versionIter.hasNext() && changeCounter++ < maxChangeListSize) {
        final Element versionElement = (Element) versionIter.next();
        final String path = versionElement.attributeValue("path");
        final String version = versionElement.attributeValue("virtualNamedVersion");
        final Change change = new Change(path, version, changeType);
        changes.add(change);
      }
      changeList.setChanges(changes);
      // Add to result
      result.add(changeList);
    }
    return result;
  }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:53,代码来源:AccurevChangeLogParser.java

示例14: getSubElementText

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *  Gets the textual content of the named subelement of provided element.
 *
 * @param  e               element containing subelement
 * @param  subElementName  name of subelement
 * @return                 the textual content of named subelement
 */
public String getSubElementText(Element e, String subElementName) {
	Element sub = e.element(subElementName);
	if (sub == null) {
		prtln("getSubElementText could not find subElement for " + subElementName);
		return "";
	}
	return sub.getText();
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:16,代码来源:AsnStatement.java

示例15: parse

import org.dom4j.Element; //导入方法依赖的package包/类
@Override
public Value parse(Element element) {
	SimpleValue simpleValue=new SimpleValue(element.getText());
	return simpleValue;
}
 
开发者ID:youseries,项目名称:ureport,代码行数:6,代码来源:SimpleValueParser.java


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