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


Java Element.getTextTrim方法代码示例

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


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

示例1: getTagValue

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 * Get the text contents of the given tag. 
 * 
 * @return - the string contents of the tag
 */
private String getTagValue( String _tag, String _namespacePrefix , String _namespaceURI )
{	
	// TODO : 09/06/06 - this function is designed to provide 
	// an introduction to the INFO XML abstraction
	String objectHandle = null; // caller is responsible for handling null
	
	try {

		Element element = this.getTagElement(_tag, _namespacePrefix, _namespaceURI);
		if ( element != null )
			objectHandle = element.getTextTrim();

	}  catch ( Exception e ) {
		e.printStackTrace();
	}
	
	return objectHandle;		
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:24,代码来源:InfoXML.java

示例2: parseFilterDef

import org.dom4j.Element; //导入方法依赖的package包/类
private static void parseFilterDef(Element element, Mappings mappings) {
	String name = element.attributeValue( "name" );
	LOG.debugf( "Parsing filter-def [%s]", name );
	String defaultCondition = element.getTextTrim();
	if ( StringHelper.isEmpty( defaultCondition ) ) {
		defaultCondition = element.attributeValue( "condition" );
	}
	HashMap paramMappings = new HashMap();
	Iterator params = element.elementIterator( "filter-param" );
	while ( params.hasNext() ) {
		final Element param = (Element) params.next();
		final String paramName = param.attributeValue( "name" );
		final String paramType = param.attributeValue( "type" );
		LOG.debugf( "Adding filter parameter : %s -> %s", paramName, paramType );
		final Type heuristicType = mappings.getTypeResolver().heuristicType( paramType );
		LOG.debugf( "Parameter heuristic type : %s", heuristicType );
		paramMappings.put( paramName, heuristicType );
	}
	LOG.debugf( "Parsed filter-def [%s]", name );
	FilterDefinition def = new FilterDefinition( name, defaultCondition, paramMappings );
	mappings.addFilterDefinition( def );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:HbmBinder.java

示例3: getEnumerated

import org.dom4j.Element; //导入方法依赖的package包/类
private void getEnumerated(List<Annotation> annotationList, Element element) {
	Element subElement = element != null ? element.element( "enumerated" ) : null;
	if ( subElement != null ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( Enumerated.class );
		String enumerated = subElement.getTextTrim();
		if ( "ORDINAL".equalsIgnoreCase( enumerated ) ) {
			ad.setValue( "value", EnumType.ORDINAL );
		}
		else if ( "STRING".equalsIgnoreCase( enumerated ) ) {
			ad.setValue( "value", EnumType.STRING );
		}
		else if ( StringHelper.isNotEmpty( enumerated ) ) {
			throw new AnnotationException( "Unknown EnumType: " + enumerated + ". " + SCHEMA_VALIDATION );
		}
		annotationList.add( AnnotationFactory.create( ad ) );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:JPAOverriddenAnnotationReader.java

示例4: getTemporal

import org.dom4j.Element; //导入方法依赖的package包/类
private void getTemporal(List<Annotation> annotationList, Element element) {
	Element subElement = element != null ? element.element( "temporal" ) : null;
	if ( subElement != null ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( Temporal.class );
		String temporal = subElement.getTextTrim();
		if ( "DATE".equalsIgnoreCase( temporal ) ) {
			ad.setValue( "value", TemporalType.DATE );
		}
		else if ( "TIME".equalsIgnoreCase( temporal ) ) {
			ad.setValue( "value", TemporalType.TIME );
		}
		else if ( "TIMESTAMP".equalsIgnoreCase( temporal ) ) {
			ad.setValue( "value", TemporalType.TIMESTAMP );
		}
		else if ( StringHelper.isNotEmpty( temporal ) ) {
			throw new AnnotationException( "Unknown TemporalType: " + temporal + ". " + SCHEMA_VALIDATION );
		}
		annotationList.add( AnnotationFactory.create( ad ) );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:JPAOverriddenAnnotationReader.java

示例5: buildUniqueConstraints

import org.dom4j.Element; //导入方法依赖的package包/类
private static void buildUniqueConstraints(AnnotationDescriptor annotation, Element element) {
	List uniqueConstraintElementList = element.elements( "unique-constraint" );
	UniqueConstraint[] uniqueConstraints = new UniqueConstraint[uniqueConstraintElementList.size()];
	int ucIndex = 0;
	Iterator ucIt = uniqueConstraintElementList.listIterator();
	while ( ucIt.hasNext() ) {
		Element subelement = (Element) ucIt.next();
		List<Element> columnNamesElements = subelement.elements( "column-name" );
		String[] columnNames = new String[columnNamesElements.size()];
		int columnNameIndex = 0;
		Iterator it = columnNamesElements.listIterator();
		while ( it.hasNext() ) {
			Element columnNameElt = (Element) it.next();
			columnNames[columnNameIndex++] = columnNameElt.getTextTrim();
		}
		AnnotationDescriptor ucAnn = new AnnotationDescriptor( UniqueConstraint.class );
		copyStringAttribute( ucAnn, subelement, "name", false );
		ucAnn.setValue( "columnNames", columnNames );
		uniqueConstraints[ucIndex++] = AnnotationFactory.create( ucAnn );
	}
	annotation.setValue( "uniqueConstraints", uniqueConstraints );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:JPAOverriddenAnnotationReader.java

示例6: parseCondition

import org.dom4j.Element; //导入方法依赖的package包/类
private PropertyExpressionCondition parseCondition(Element ele) {
	PropertyExpressionCondition condition=new PropertyExpressionCondition();				
	String property=ele.attributeValue("property");
	condition.setLeftProperty(property);
	condition.setLeft(property);
	condition.setOp(Op.parse(ele.attributeValue("op")));
	for(Object o:ele.elements()){
		if(o==null || !(o instanceof Element)){
			continue;
		}
		Element e=(Element)o;
		if(!e.getName().equals("value")){
			continue;
		}
		String expr=e.getTextTrim();
		condition.setRightExpression(ExpressionUtils.parseExpression(expr));
		condition.setRight(expr);
		break;
	}
	String join=ele.attributeValue("join");
	if(StringUtils.isNotBlank(join)){
		condition.setJoin(Join.valueOf(join));
	}
	return condition;
}
 
开发者ID:youseries,项目名称:ureport,代码行数:26,代码来源:DatasetValueParser.java

示例7: getImportCellDescList

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *
 * 将xml单元格元素解析到ExcelStruct中
 *
 * @param excelStruct Excel导入描述文件的结构
 * @param list 单元格元素list
 */
private static List<ImportCellDesc> getImportCellDescList(ExcelStruct excelStruct, List list){
    if(list == null || list.size() <= 0){
        return null;
    }
    // 获取CDATA区内的内容
    Element cdataElem = (Element) list.get(0);
    String cdataStr = cdataElem.getTextTrim();
    List<ImportCellDesc> importCells = changeCDATAToList(excelStruct, cdataStr);
    return importCells;
}
 
开发者ID:ssqfzc,项目名称:ExcelUtils,代码行数:18,代码来源:ParseXMLUtil.java

示例8: getChildren

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *  Returns children as Standard instances in same order as the XML Element
 *  defining this Standard
 *
 * @return    The children value
 */
public List getChildren() {
	if (this.children == null) {
		this.children = new ArrayList();
		try {
			Element hasChild = element.element("children");
			if (hasChild == null) {
				// prtln ("Leaf node: " + this.getId());
				return this.children;
			}
			List childElements = hasChild.elements("child");
			for (Iterator i = childElements.iterator(); i.hasNext(); ) {
				Element childElement = (Element) i.next();
				String childId = childElement.getTextTrim();
				// prtln ("childId: " + childId);
				Standard std = this.getStd(childId);
				if (std == null) {
					prtln("WARNING: ASN Document error: std not found for " + childId);
					continue;
				}
				this.addChild(std);
			}
		} catch (Throwable t) {
			prtln("trouble getting children for " + this.getId() + ": " + t.getMessage());
			t.printStackTrace();
			System.exit(1);
		}
	}
	return children;
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:36,代码来源:Standard.java

示例9: 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, String defaultVal) {
	Element sub = e.element(subElementName);
	if (sub == null) {
		prtln("getSubElementText could not find subElement for " + subElementName);
		return defaultVal;
	}
	return sub.getTextTrim();
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:16,代码来源:StdElement.java

示例10: extractDocumentation

import org.dom4j.Element; //导入方法依赖的package包/类
public void extractDocumentation () {
	Element docElement = (Element) this.element.selectSingleNode (this.xsdPrefix + ":annotation/"  +
								                                  this.xsdPrefix + ":documentation");
	if (docElement != null) {
		String docString = docElement.getTextTrim();
		if (docString != null && docString.length() > 0)
			this.documentation = docString;
		else
			this.documentation = null;
	}
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:12,代码来源:GlobalDeclaration.java

示例11: extractDocumentation

import org.dom4j.Element; //导入方法依赖的package包/类
public void extractDocumentation () {
	Element docElement = (Element) this.element.selectSingleNode (this.xsdPrefix + ":attribute/"  +
																  this.xsdPrefix + ":annotation/"  +
								                                  this.xsdPrefix + ":documentation");
	if (docElement != null) {
		this.documentation = docElement.getTextTrim();
	}
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:9,代码来源:AttributeGroup.java

示例12: extractDocumentation

import org.dom4j.Element; //导入方法依赖的package包/类
/**  Find documentation within this type definition. */
public void extractDocumentation() {
	Element docElement = (Element) this.element.selectSingleNode(this.xsdPrefix + ":annotation/" +
		this.xsdPrefix + ":documentation");
	if (docElement != null) {
		String docString = docElement.getTextTrim();
		if (docString != null && docString.length() > 0)
			this.documentation = docString;
		else
			this.documentation = null;
	}
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:13,代码来源:GenericType.java

示例13: hasChildren

import org.dom4j.Element; //导入方法依赖的package包/类
/**
 *  Return true if the specified node is an Element and has either a
 *  sub-element, or an attribute (even if they are empty), OR content.
 *
 * @param  xpath  xpath to the node to be evaluated for children
 * @return        true if sub-elements, or attributes, false otherwise or if
 *      node is not an Element
 */
public boolean hasChildren(String xpath) {
	// prtln ("\nhasChildren: " + xpath);
	if (xpath == null || xpath.trim().length() == 0)
		return false;
	Node node = doc.selectSingleNode(xpath);
	if (node == null) {
		prtlnErr("\thasChildren() could not find node: (" + xpath + ")");
		return false;
	}

	if (node.getNodeType() != Node.ELEMENT_NODE) {
		prtlnErr("hasChildern() called with an non-Element - returning false");
		return false;
	}

	Element e = (Element) node;

	// we used to check for "hasText" but why would we want to do that here???
	/*
		We DO want to check in the case of an element that can contain text which ALSO
		has attributes. So we can do this check IF the typeDef is the right kind ...
	*/
	boolean hasText = (e.getTextTrim() != null && e.getTextTrim().length() > 0);
	if (hasText)
		return true;

	return (e.elements().size() > 0 ||
		e.attributeCount() > 0);
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:38,代码来源:DocMap.java

示例14: parseFilter

import org.dom4j.Element; //导入方法依赖的package包/类
private static void parseFilter(Element filterElement, Filterable filterable, Mappings model) {
	final String name = filterElement.attributeValue( "name" );
	String condition = filterElement.getTextTrim();
	if ( StringHelper.isEmpty(condition) ) {
		condition = filterElement.attributeValue( "condition" );
	}
	//TODO: bad implementation, cos it depends upon ordering of mapping doc
	//      fixing this requires that Collection/PersistentClass gain access
	//      to the Mappings reference from Configuration (or the filterDefinitions
	//      map directly) sometime during Configuration.build
	//      (after all the types/filter-defs are known and before building
	//      persisters).
	if ( StringHelper.isEmpty(condition) ) {
		condition = model.getFilterDefinition(name).getDefaultFilterCondition();
	}
	if ( condition==null) {
		throw new MappingException("no filter condition found for filter: " + name);
	}
	Iterator aliasesIterator = filterElement.elementIterator("aliases");
	java.util.Map<String, String> aliasTables = new HashMap<String, String>();
	while (aliasesIterator.hasNext()){
		Element alias = (Element) aliasesIterator.next();
		aliasTables.put(alias.attributeValue("alias"), alias.attributeValue("table"));
	}
	LOG.debugf( "Applying filter [%s] as [%s]", name, condition );
	String autoAliasInjectionText = filterElement.attributeValue("autoAliasInjection");
	boolean autoAliasInjection = StringHelper.isEmpty(autoAliasInjectionText) ? true : Boolean.parseBoolean(autoAliasInjectionText);
	filterable.addFilter(name, condition, autoAliasInjection, aliasTables, null);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:HbmBinder.java

示例15: publish

import org.dom4j.Element; //导入方法依赖的package包/类
@Override
public void publish(Client zkClient) {
	Set<Map.Entry<String, Document>> docEntries = xmlsMap.entrySet();
	Element rootEle = null;
	try {
		for (Map.Entry<String, Document> docEntry : docEntries) {
			String zkPath = docEntry.getKey();
			Document xmlResource = docEntry.getValue();
			rootEle = xmlResource.getRootElement();
			List<Element> paramsList = rootEle.elements("params");
			for (Element paramEle : paramsList) {
				String paramName = paramEle.attributeValue("name");
				List<Element> paramList = paramEle.elements("param");
				for (Element param : paramList) {
					String paramKey = param.attributeValue("name");
					String content = param.getTextTrim();
					ZkNodeUtil.createOrUpdateZnode(zkClient, zkPath + "/" + paramName + "/" + paramKey, content);
				}

			}
		}

	} catch (Exception e) {
		getLogger().error(e.getMessage(), e);
		e.printStackTrace();
	}
}
 
开发者ID:jtjsir,项目名称:zookeeper-test-demo,代码行数:28,代码来源:XmlPublishTask.java


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