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


Java Element.getNodeType方法代码示例

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


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

示例1: fillCommareaFromXML

import org.w3c.dom.Element; //导入方法依赖的package包/类
private Element fillCommareaFromXML(Element elt, ByteArrayOutputStream stream) {
	if (elt != null) {
		if (elt.getNodeType() == Node.ELEMENT_NODE) {
			fillFromXMLElement(elt, stream);
			
			NodeList children = elt.getChildNodes();
			int len = children.getLength();
			if (len > 0) {
				for (int i=0; i<len; i++) {
					Node child = children.item(i);
					if (child.getNodeType() == Node.ELEMENT_NODE)
						fillCommareaFromXML((Element)child, stream);
				}
			}
		}
	}
	return elt;
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:19,代码来源:CicsTransaction.java

示例2: fillXMLFromCommarea

import org.w3c.dom.Element; //导入方法依赖的package包/类
private Element fillXMLFromCommarea(Element elt, ByteArrayInputStream stream, Vector<Integer> v) {
	if (elt != null) {
		if (v == null) {
			v = new Vector<Integer>();
			v.add(new Integer(0));
			v.add(new Integer(0));
		}
		if (elt.getNodeType() == Node.ELEMENT_NODE) {
			fillXMLElement(elt, stream, v);
			
			NodeList children = elt.getChildNodes();
			int len = children.getLength();
			if (len > 0) {
				for (int i=0; i<len; i++) {
					Node child = children.item(i);
					if (child.getNodeType() == Node.ELEMENT_NODE)
						fillXMLFromCommarea((Element)child, stream, v);
				}
			}
		}
	}
	return elt;
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:24,代码来源:CicsTransaction.java

示例3: getAllStudentProgress

import org.w3c.dom.Element; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
   private Element getAllStudentProgress(Document document, String serverId, String datetime, String hashValue,
    String username, long lsId, String courseID) throws RemoteException {
try {
    ExtServer extServer = integrationService.getExtServer(serverId);
    Authenticator.authenticate(extServer, datetime, username, hashValue);
    Lesson lesson = lessonService.getLesson(lsId);

    Element element = document.createElement(CentralConstants.ELEM_LESSON_PROGRESS);
    element.setAttribute(CentralConstants.ATTR_LESSON_ID, "" + lsId);

    String prefix = extServer.getPrefix();
    if (lesson != null) {

	int activitiesTotal = lesson.getLearningDesign().getActivities().size();
	Iterator<LearnerProgress> iterator = lesson.getLearnerProgresses().iterator();
	while (iterator.hasNext()) {
	    LearnerProgress learnProg = iterator.next();
	    LearnerProgressDTO learnerProgress = learnProg.getLearnerProgressData();

	    // get the username with the integration prefix removed
	    String userNoPrefixName = learnerProgress.getUserName().substring(prefix.length() + 1);
	    ExtUserUseridMap learnerMap = integrationService.getExtUserUseridMap(extServer, userNoPrefixName);

	    Element learnerProgElem = document.createElement(CentralConstants.ELEM_LEARNER_PROGRESS);

	    int completedActivities = learnerProgress.getCompletedActivities().length;
	    int attemptedActivities = learnerProgress.getAttemptedActivities().length;

	    if (learnerProgElem.getNodeType() == Node.ELEMENT_NODE) {
		learnerProgElem.setAttribute(CentralConstants.ATTR_LESSON_COMPLETE,
			"" + learnerProgress.getLessonComplete());
		learnerProgElem.setAttribute(CentralConstants.ATTR_ACTIVITY_COUNT, "" + activitiesTotal);
		learnerProgElem.setAttribute(CentralConstants.ATTR_ACTIVITIES_COMPLETED,
			"" + completedActivities);
		learnerProgElem.setAttribute(CentralConstants.ATTR_ACTIVITIES_ATTEMPTED,
			"" + attemptedActivities);
		// learnerProgElem.setAttribute(CentralConstants.ATTR_CURRENT_ACTIVITY , currActivity);
		learnerProgElem.setAttribute(CentralConstants.ATTR_STUDENT_ID, "" + learnerMap.getSid());
		learnerProgElem.setAttribute(CentralConstants.ATTR_COURSE_ID, courseID);
		learnerProgElem.setAttribute(CentralConstants.ATTR_USERNAME, userNoPrefixName);
		learnerProgElem.setAttribute(CentralConstants.ATTR_LESSON_ID, "" + lsId);
	    }

	    element.appendChild(learnerProgElem);
	}
    } else {
	throw new Exception("Lesson with lessonID: " + lsId + " could not be found for learner progresses");
    }

    return element;

} catch (Exception e) {
    throw new RemoteException(e.getMessage(), e);
}

   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:58,代码来源:LessonManagerServlet.java

示例4: getSingleStudentProgress

import org.w3c.dom.Element; //导入方法依赖的package包/类
private Element getSingleStudentProgress(Document document, String serverId, String datetime, String hashValue,
    String username, String firstName, String lastName, String language, String country, String email,
    long lsId, String courseID) throws RemoteException {
try {
    ExtServer extServer = integrationService.getExtServer(serverId);
    Authenticator.authenticate(extServer, datetime, username, hashValue);
    Lesson lesson = lessonService.getLesson(lsId);

    Element element = document.createElement(CentralConstants.ELEM_LESSON_PROGRESS);
    element.setAttribute(CentralConstants.ATTR_LESSON_ID, "" + lsId);

    if (lesson != null) {
	int activitiesTotal = lesson.getLearningDesign().getActivities().size();

	// create new user if required
	final boolean usePrefix = true;
	final boolean isUpdateUserDetails = false;
	ExtUserUseridMap userMap = integrationService.getImplicitExtUserUseridMap(extServer, username,
		firstName, lastName, language, country, email, usePrefix, isUpdateUserDetails);

	LearnerProgress learnProg = lessonService.getUserProgressForLesson(userMap.getUser().getUserId(), lsId);

	Element learnerProgElem = document.createElement(CentralConstants.ELEM_LEARNER_PROGRESS);

	// if learner progress exists, make a response, otherwise, return an empty learner progress element
	if (learnProg != null) {
	    LearnerProgressDTO learnerProgress = learnProg.getLearnerProgressData();

	    int completedActivities = learnerProgress.getCompletedActivities().length;
	    int attemptedActivities = learnerProgress.getAttemptedActivities().length;

	    if (learnerProgElem.getNodeType() == Node.ELEMENT_NODE) {
		learnerProgElem.setAttribute(CentralConstants.ATTR_LESSON_COMPLETE,
			"" + learnerProgress.getLessonComplete());
		learnerProgElem.setAttribute(CentralConstants.ATTR_ACTIVITY_COUNT, "" + activitiesTotal);
		learnerProgElem.setAttribute(CentralConstants.ATTR_ACTIVITIES_COMPLETED,
			"" + completedActivities);
		learnerProgElem.setAttribute(CentralConstants.ATTR_ACTIVITIES_ATTEMPTED,
			"" + attemptedActivities);
		// learnerProgElem.setAttribute(CentralConstants.ATTR_CURRENT_ACTIVITY , currActivity);
		learnerProgElem.setAttribute(CentralConstants.ATTR_STUDENT_ID, "" + userMap.getSid());
		learnerProgElem.setAttribute(CentralConstants.ATTR_COURSE_ID, courseID);
		learnerProgElem.setAttribute(CentralConstants.ATTR_USERNAME, username);
		learnerProgElem.setAttribute(CentralConstants.ATTR_LESSON_ID, "" + lsId);
	    }
	} else {
	    if (learnerProgElem.getNodeType() == Node.ELEMENT_NODE) {
		learnerProgElem.setAttribute(CentralConstants.ATTR_LESSON_COMPLETE, "false");
		learnerProgElem.setAttribute(CentralConstants.ATTR_ACTIVITY_COUNT, "" + activitiesTotal);
		learnerProgElem.setAttribute(CentralConstants.ATTR_ACTIVITIES_COMPLETED, "0");
		learnerProgElem.setAttribute(CentralConstants.ATTR_ACTIVITIES_ATTEMPTED, "0");
		// learnerProgElem.setAttribute(CentralConstants.ATTR_CURRENT_ACTIVITY , currActivity);
		learnerProgElem.setAttribute(CentralConstants.ATTR_STUDENT_ID, "" + userMap.getSid());
		learnerProgElem.setAttribute(CentralConstants.ATTR_COURSE_ID, courseID);
		learnerProgElem.setAttribute(CentralConstants.ATTR_USERNAME, username);
		learnerProgElem.setAttribute(CentralConstants.ATTR_LESSON_ID, "" + lsId);
	    }
	}

	element.appendChild(learnerProgElem);
    } else {
	throw new Exception("Lesson with lessonID: " + lsId + " could not be found for learner progresses");
    }

    return element;

} catch (Exception e) {
    throw new RemoteException(e.getMessage(), e);
}

   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:72,代码来源:LessonManagerServlet.java


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