當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。