List of usage examples for org.dom4j DocumentHelper createElement
public static Element createElement(String name)
From source file:org.ednovo.gooru.application.util.ResourceInstanceFormatter.java
License:Open Source License
public String getResourceInstanceXmls(List<ResourceInstance> resourceInstances) { Element resourcesElement = DocumentHelper.createElement(RESOURCES); for (ResourceInstance resourceInstance : resourceInstances) { Element element = getResourceInstance(resourceInstance); if (element != null) { resourcesElement.add(element); }//from ww w . java 2 s . c o m } return resourcesElement.asXML(); }
From source file:org.ednovo.gooru.application.util.ResourceInstanceFormatter.java
License:Open Source License
private Element getSegment(Segment segment) { Element element = DocumentHelper.createElement(SEGMENT); element.addAttribute(ID, segment.getSegmentId()); String duration = segment.getDuration(); duration = (duration == null || duration.trim().equals("")) ? "0" : duration; setElementText(element, DURATION, duration, true); setElementText(element, TITLE, segment.getTitle(), true); setElementText(element, DESCRIPTION, segment.getDescription(), true); Element resources = element.addElement(RESOURCES); getSegmentResourceXmls(resources, segment); Element rendition = element.addElement(RENDITION); setElementText(rendition, NATIVE_URL, segment.getRenditionUrl(), true); setElementText(element, TYPE, (segment.getType() == null) ? DIRECT_INSTRUCTION : segment.getType(), true); setElementText(element, CONCEPT, segment.getConcept(), true); setElementText(element, SEGMENT_IMAGE, segment.getSegmentImage(), true); return element; }
From source file:org.ednovo.gooru.application.util.ResourceInstanceFormatter.java
License:Open Source License
public String getResourceSegmentXmls(Set<Segment> segments) { Element element = DocumentHelper.createElement(SEGMENTS); getResourceSegments(element, segments); return element.asXML(); }
From source file:org.ednovo.gooru.application.util.ResourceInstanceFormatter.java
License:Open Source License
public Element getLearnguideInfo(Learnguide learnguide) { Element infoElement = DocumentHelper.createElement(INFO); setElementText(infoElement, LESSON, learnguide.getLesson(), true); String duration = learnguide.getDuration(); duration = (duration == null || duration.trim().equals("")) ? ZERO : duration; setElementText(infoElement, DURATION, duration, true); setElementText(infoElement, VOCABULARY, learnguide.getVocabulary(), true); setElementText(infoElement, LESSON_OBJECTIVES, learnguide.getGoals(), true); Element curriculumElements = infoElement.addElement(CURRICULUMS); setElementText(curriculumElements, CURRICULUM, learnguide.getCurriculum(), true); setElementText(infoElement, INSTRUCTION, learnguide.getMedium(), true); setElementText(infoElement, NOTES, learnguide.getNotes(), true); setElementText(infoElement, GRADE, learnguide.getGrade(), true); return infoElement; }
From source file:org.ednovo.gooru.application.util.ResourceInstanceFormatter.java
License:Open Source License
private Element getLearnguide(Learnguide learnguide, boolean retriveSkeletons) { Element element = DocumentHelper.createElement(GOORU_CLASSPLAN); element.add(getLearnguideInfo(learnguide)); Element segmentElements = element.addElement(SEGMENTS); if (learnguide.getResourceSegments() != null) { getResourceSegments(segmentElements, learnguide.getResourceSegments(), retriveSkeletons); }//from w w w . j av a2 s .c o m return element; }
From source file:org.efaps.webdav4vfs.test.AbstractDavTestCase.java
License:Apache License
protected Element serializeDavResource(final FileObject _object, final String _propertyName) throws FileSystemException { final Element root = DocumentHelper.createElement("root"); final DavResourceFactory factory = DavResourceFactory.getInstance(); final DavResource davResource = factory.getDavResource(_object); Element testPropertyEl = (Element) root.addElement("prop").detach(); testPropertyEl.addElement(_propertyName); davResource.getPropertyValues(root, testPropertyEl); return root;/*w w w . j av a2 s . c om*/ }
From source file:org.etudes.component.app.melete.MeleteAbstractExportServiceImpl.java
License:Apache License
/** * creates document root element "manifest" and adds the namespaces * * @return returns the manifest element/*w w w.j ava2 s .co m*/ * @throws Exception */ public Element createManifest() throws Exception { Element root = DocumentHelper.createElement("manifest"); //Set up the necessary namespaces root.setQName(new QName("manifest", new Namespace(null, DEFAULT_NAMESPACE_URI))); root.add(new Namespace("imsmd", getMetaDataNameSpace())); root.add(new Namespace("xsi", "http://www.w3.org/2001/XMLSchema-instance")); /*root.addAttribute("xsi:schemaLocation", "http://www.imsglobal.org/xsd/imscp_v1p1 " + "http://www.imsglobal.org/xsd/imscp_v1p1.xsd " + "http://www.imsglobal.org/xsd/imsmd_v1p2 " + "http://www.imsglobal.org/xsd/imsmd_v1p2.xsd "); */ root.addAttribute("identifier", "Manifest-" + getUUID()); root.addAttribute("version", "IMS CP 1.1.4"); return root; }
From source file:org.etudes.component.app.melete.MeleteAbstractExportServiceImpl.java
License:Apache License
/** * creates the default namespace element * @param elename - element name/*from w w w . jav a 2s . c om*/ * @param qname - qualified name * @return - returns the default namespace element */ public Element createDefaultNSElement(String elename, String qname) { Element metadata = DocumentHelper.createElement(elename); metadata.setQName(new QName(qname, new Namespace(null, DEFAULT_NAMESPACE_URI))); return metadata; }
From source file:org.etudes.component.app.melete.MeleteAbstractExportServiceImpl.java
License:Apache License
/** * creates the LOM metadata element//ww w . ja v a 2 s . c om * @param elename - element name * @param qname - qualified name * @return - returns the metadata element */ public Element createLOMElement(String elename, String qname) { Element imsmdlom = DocumentHelper.createElement(elename); imsmdlom.setQName(new QName(qname, new Namespace("imsmd", getMetaDataNameSpace()))); return imsmdlom; }
From source file:org.etudes.jforum.view.admin.ImportExportAction.java
License:Apache License
/** * creates the default namespace element * //from ww w. ja va 2 s. c o m * @param elename * - element name * @param qname * - qualified name * @return - returns the default namespace element */ private Element createDefaultNSElement(String elename, String qname) { Element metadata = DocumentHelper.createElement(elename); metadata.setQName(new QName(qname, new Namespace(null, DEFAULT_NAMESPACE_URI))); return metadata; }