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


Java Element.elementText方法代码示例

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


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

示例1: importXML

import com.liferay.portal.kernel.xml.Element; //导入方法依赖的package包/类
public void importXML(long actId, Element question, TestAnswerLocalService testAnswerLocalService)throws SystemException, PortalException {
	//"cloze"
	Element name=question.element("name");
	String description=(name!=null)?name.elementText("text"):"";
	TestQuestion theQuestion=TestQuestionLocalServiceUtil.addQuestion(actId,description,getTypeId());
	Element questiontext=question.element("questiontext");
	String answer=questiontext.elementText("text");
	Element generalFeedback=question.element("generalfeedback");
	String feedback=generalFeedback.elementText("text");
	String feedbackCorrect = "", feedbackNoCorrect="";
	if(feedback.contains("//")){
		String[] split = feedback.split("//");
		if(split.length == 2){
			feedbackCorrect = split[0];
			feedbackNoCorrect = split[1];
		}else{
			feedbackCorrect = feedback;
			feedbackNoCorrect = feedback;
		}
	}else{
		feedbackCorrect = feedback;
		feedbackNoCorrect = feedback;
	}
	testAnswerLocalService.addTestAnswer(theQuestion.getQuestionId(), answer, feedbackCorrect, feedbackNoCorrect, true);
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:26,代码来源:FillblankQuestionType.java

示例2: importXML

import com.liferay.portal.kernel.xml.Element; //导入方法依赖的package包/类
public void importXML(long actId, Element question, TestAnswerLocalService testAnswerLocalService)throws SystemException, PortalException {
	//"essay","numerical","shortanswer"
	Element questiontext=question.element("questiontext");
	String description=questiontext.elementText("text");
	TestQuestion theQuestion=TestQuestionLocalServiceUtil.addQuestion(actId,description,getTypeId());
	if(!"essay".equals(question.attributeValue("type"))){//los essay en moodle nunca tienen respuesta
		for(Element answerElement:question.elements("answer")){
			boolean correct=("100".equals(answerElement.attributeValue("fraction")))? true:false;
			String answer=answerElement.elementText("text");
			String feedback="", feedbackCorrect="", feedbackNoCorrect="";
			if(answerElement.element("feedback")!=null && answerElement.element("feedback").element("text")!=null)
				feedback=answerElement.element("feedback").element("text").getText();	 
			if(feedback.contains("//")){
				String[] split = feedback.split("//");
				if(split.length == 2){
					feedbackCorrect = split[0];
					feedbackNoCorrect = split[1];
				}else{
					feedbackCorrect = feedback;
					feedbackNoCorrect = feedback;
				}
			}else{
				feedbackCorrect = feedback;
				feedbackNoCorrect = feedback;
			}
			testAnswerLocalService.addTestAnswer(theQuestion.getQuestionId(), answer, feedbackCorrect, feedbackNoCorrect, correct);
			return;//porque inicialmente solo aceptamos una respuesta
		}
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:31,代码来源:FreetextQuestionType.java

示例3: importXML

import com.liferay.portal.kernel.xml.Element; //导入方法依赖的package包/类
public void importXML(long actId, Element question, TestAnswerLocalService testAnswerLocalService)throws SystemException, PortalException {
	Element questiontext=question.element("questiontext");
	String description=questiontext.elementText("text");
	TestQuestion theQuestion=TestQuestionLocalServiceUtil.addQuestion(actId,description,getTypeId());
	for(Element answerElement:question.elements("answer")){
		boolean correct=(!"0".equals(answerElement.attributeValue("fraction")))? true:false;
		String answer=answerElement.elementText("text");
		String feedback="";
		if(answerElement.element("feedback")!=null && answerElement.element("feedback").element("text")!=null)
			feedback=answerElement.element("feedback").element("text").getText();
		testAnswerLocalService.addTestAnswer(theQuestion.getQuestionId(), answer, feedback, feedback, correct);
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:14,代码来源:OptionsQuestionType.java

示例4: importXML

import com.liferay.portal.kernel.xml.Element; //导入方法依赖的package包/类
public void importXML(long actId, Element question, TestAnswerLocalService testAnswerLocalService)throws SystemException, PortalException {
	Element questiontext=question.element("questiontext");
	String description=questiontext.elementText("text");
	TestQuestion theQuestion=TestQuestionLocalServiceUtil.addQuestion(actId,description,getTypeId());
	for(Element answerElement:question.elements("answer")){
		boolean correct=true;
		String answer=answerElement.elementText("text");
		testAnswerLocalService.addTestAnswer(theQuestion.getQuestionId(), answer, "", "", correct);
	}
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:11,代码来源:SortableQuestionType.java


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