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