List of usage examples for org.dom4j Element getQualifiedName
String getQualifiedName();
From source file:org.etudes.component.app.melete.MeleteImportServiceImpl.java
License:Apache License
private void removeNamespaces(Element elem) { elem.setQName(QName.get(elem.getName(), Namespace.NO_NAMESPACE, elem.getQualifiedName())); Node n = null;// www . j ava2s. c o m for (int i = 0; i < elem.content().size(); i++) { n = (Node) elem.content().get(i); if (n.getNodeType() == Node.ATTRIBUTE_NODE) ((Attribute) n).setNamespace(Namespace.NO_NAMESPACE); if (n.getNodeType() == Node.ELEMENT_NODE) removeNamespaces((Element) n); } }
From source file:org.etudes.component.app.melete.MeleteImportServiceImpl.java
License:Apache License
private String readTitlefromElement(List resElements, boolean link, String hrefVal) { String urlTitle = null;/* w w w . java 2 s .c o m*/ if (resElements != null) { for (int i = 0; i < resElements.size(); i++) { Element urlTitleElement = (Element) resElements.get(i); if (urlTitleElement.getQualifiedName().equalsIgnoreCase("imsmd:title")) { urlTitle = urlTitleElement.selectSingleNode(".//imsmd:langstring").getText(); break; } } } // make last part of link as title if (link && urlTitle == null) { urlTitle = hrefVal.substring(hrefVal.lastIndexOf("/") + 1); if (urlTitle == null || urlTitle.length() == 0) { urlTitle = hrefVal.substring(0, hrefVal.lastIndexOf("/")); urlTitle = urlTitle.substring(urlTitle.lastIndexOf("/") + 1); } } return urlTitle; }
From source file:org.etudes.component.app.melete.MeleteImportServiceImpl.java
License:Apache License
private String readDescriptionFromElement(List resElements) { String melResourceDescription = null; if (resElements != null) { for (int i = 0; i < resElements.size(); i++) { Element resDescElement = (Element) resElements.get(i); if (resDescElement.getQualifiedName().equalsIgnoreCase("imsmd:description")) { melResourceDescription = resDescElement.selectSingleNode(".//imsmd:langstring").getText(); break; }/*from www . j a v a 2s. c om*/ } } return melResourceDescription; }
From source file:org.etudes.component.app.melete.MeleteImportServiceImpl.java
License:Apache License
/** * Builds section for each item under module item * @param eleItem item element//from w ww .j ava 2 s . c om * @param document document * @param module Module * @throws Exception */ private void buildSection(Element eleItem, Document document, Module module, Element seqElement, String unZippedDirPath, Document seqDocument, String courseId) throws Exception { if (logger.isDebugEnabled()) logger.debug("Entering buildSection..."); Attribute identifier = eleItem.attribute("identifier"); // logger.debug("importing ITEM " + identifier.getValue()); Attribute identifierref = eleItem.attribute("identifierref"); Element eleRes; Section section = new Section(); MeleteResource meleteResource = new MeleteResource(); boolean sectionTitleFlag = false; boolean sectionCopyrightFlag = false; List elements = eleItem.elements(); for (Iterator iter = elements.iterator(); iter.hasNext();) { Element element = (Element) iter.next(); //title if (element.getQualifiedName().equalsIgnoreCase("title")) { section.setTitle(element.getTextTrim()); sectionTitleFlag = true; } //item else if (element.getQualifiedName().equalsIgnoreCase("item")) { //call recursive here buildSection(element, document, module, addBlankSection(seqElement, seqDocument), unZippedDirPath, seqDocument, courseId); } //metadata else if (element.getQualifiedName().equalsIgnoreCase("imsmd:lom")) { // section instructions Element DescElement = null; if (eleItem.selectNodes("./imsmd:lom/imsmd:general/imsmd:description") != null && (eleItem.selectNodes("./imsmd:lom/imsmd:general/imsmd:description").size() != 0)) DescElement = (Element) eleItem.selectNodes("./imsmd:lom/imsmd:general/imsmd:description") .get(0); if (DescElement != null) { String instr = DescElement.selectSingleNode(".//imsmd:langstring").getText(); section.setInstr(instr.trim()); } // read license information Element rightsElement = null; if (eleItem.selectNodes("./imsmd:lom/imsmd:rights") != null && (eleItem.selectNodes("./imsmd:lom/imsmd:rights").size() != 0)) rightsElement = (Element) eleItem.selectNodes("./imsmd:lom/imsmd:rights").get(0); if (rightsElement != null) { Element licenseElement = rightsElement.element("description"); String licenseUrl = licenseElement.selectSingleNode(".//imsmd:langstring").getText(); if (licenseUrl != null) buildLicenseInformation(meleteResource, licenseUrl); sectionCopyrightFlag = true; } } // license end } // other attributes // logger.debug("setting section attribs"); String userId = UserDirectoryService.getCurrentUser().getEid(); String firstName = UserDirectoryService.getCurrentUser().getFirstName(); String lastName = UserDirectoryService.getCurrentUser().getLastName(); section.setTextualContent(true); section.setCreatedByFname(firstName); section.setCreatedByLname(lastName); section.setContentType("notype"); if (!sectionTitleFlag) section.setTitle("Untitled Section"); //default to no license if (!sectionCopyrightFlag) { meleteResource.setLicenseCode(RESOURCE_LICENSE_CODE); meleteResource.setCcLicenseUrl(RESOURCE_LICENSE_URL); } // save section object Integer new_section_id = sectionDB.addSection(module, section, true); section.setSectionId(new_section_id); seqElement.addAttribute("id", new_section_id.toString()); // now melete resource object if (identifierref != null) { eleRes = getResource(identifierref.getValue(), document); if (eleRes != null) { Attribute resHrefAttr = eleRes.attribute("href"); if (resHrefAttr != null) { String hrefVal = resHrefAttr.getValue(); // logger.debug("hrefVal:" + hrefVal); // check if file is missing if (hrefVal != null && hrefVal.length() != 0 && !(hrefVal.startsWith("http://") || hrefVal.startsWith("https://") || hrefVal.startsWith("mailto:"))) { hrefVal = getFileNamefromElement(eleRes.elements(), hrefVal); if (!meleteUtil.checkFileExists(unZippedDirPath + File.separator + hrefVal)) { logger.info("content file for section is missing so move ON"); return; } } // end missing file check // create meleteResourceObject List resElements = eleRes.elements(); createContentResource(module, section, meleteResource, hrefVal, resElements, unZippedDirPath, courseId); } // resHrefAttr check end } } if (logger.isDebugEnabled()) logger.debug("Exiting buildSection..."); }
From source file:org.etudes.component.app.melete.MeleteImportServiceImpl.java
License:Apache License
/** * Builds section for each item under module item * @param eleItem item element/*w w w . java 2 s . c om*/ * @param document document * @param module Module * @throws Exception */ private void mergeSection(Element eleItem, Document document, Module module, Element seqElement, String unZippedDirPath, Document seqDocument, String courseId) throws Exception { if (logger.isDebugEnabled()) logger.debug("Entering mergeSection..."); Attribute identifier = eleItem.attribute("identifier"); // // logger.debug("importing ITEM " + identifier.getValue()); Attribute identifierref = eleItem.attribute("identifierref"); Element eleRes; Section section = new Section(); MeleteResource meleteResource = new MeleteResource(); boolean sectionTitleFlag = false; boolean sectionCopyrightFlag = false; List elements = eleItem.elements(); for (Iterator iter = elements.iterator(); iter.hasNext();) { Element element = (Element) iter.next(); // title if (element.getQualifiedName().equalsIgnoreCase("title")) { section.setTitle(element.getTextTrim()); sectionTitleFlag = true; } // item else if (element.getQualifiedName().equalsIgnoreCase("item")) { // call recursive here buildSection(element, document, module, addBlankSection(seqElement, seqDocument), unZippedDirPath, seqDocument, courseId); } // metadata else if (element.getName().equalsIgnoreCase("imsmd:lom")) { // section instructions List<Element> modulegeneralList = element.elements(); List moduleMetadataList = modulegeneralList.get(0).elements(); for (Iterator iter2 = moduleMetadataList.iterator(); iter2.hasNext();) { Element metaElement = (Element) iter2.next(); if (metaElement.getName().equals("imsmd:description") && metaElement.element("imsmd:langstring") != null) { String instr = metaElement.element("imsmd:langstring").getText(); section.setInstr(instr.trim()); } } // read license information if (modulegeneralList.size() > 1) { List rightList = modulegeneralList.get(1).elements(); for (Iterator iter3 = rightList.iterator(); iter3.hasNext();) { Element rightsElement = (Element) iter3.next(); if (rightsElement.getName().equals("imsmd:description") && rightsElement.element("imsmd:langstring") != null) { String licenseUrl = rightsElement.element("imsmd:langstring").getText(); if (licenseUrl != null) { buildLicenseInformation(meleteResource, licenseUrl); sectionCopyrightFlag = true; } } } } } // license end } // other attributes // logger.debug("setting section attribs"); String userId = UserDirectoryService.getCurrentUser().getEid(); String firstName = UserDirectoryService.getCurrentUser().getFirstName(); String lastName = UserDirectoryService.getCurrentUser().getLastName(); section.setTextualContent(true); section.setCreatedByFname(firstName); section.setCreatedByLname(lastName); section.setContentType("notype"); if (!sectionTitleFlag) section.setTitle("Untitled Section"); // default to no license if (!sectionCopyrightFlag) { meleteResource.setLicenseCode(RESOURCE_LICENSE_CODE); meleteResource.setCcLicenseUrl(RESOURCE_LICENSE_URL); } // save section object Integer new_section_id = sectionDB.addSection(module, section, true); section.setSectionId(new_section_id); seqElement.addAttribute("id", new_section_id.toString()); // now melete resource object if (identifierref != null) { eleRes = getMergeResource(identifierref.getValue(), document); if (eleRes != null) { Attribute resHrefAttr = eleRes.attribute("href"); if (resHrefAttr != null) { String hrefVal = resHrefAttr.getValue(); // check if file is missing if (hrefVal != null && hrefVal.length() != 0 && !(hrefVal.startsWith("http://") || hrefVal.startsWith("https://") || hrefVal.startsWith("mailto:"))) { if (!meleteUtil.checkFileExists(unZippedDirPath + File.separator + hrefVal)) { logger.info("content file for section is missing so move ON"); return; } } // end missing file check // create meleteResourceObject List resElements = eleRes.elements(); createContentResource(module, section, meleteResource, hrefVal, resElements, unZippedDirPath, courseId); } // resHrefAttr check end } } if (logger.isDebugEnabled()) logger.debug("Exiting mergeSection..."); }
From source file:org.etudes.jforum.view.admin.ImportExportAction.java
License:Apache License
/** * process attachments/*w ww .ja v a2 s. c o m*/ * * @param eleRes * @param forum * @param document * @param unZippedDirPath * @param postId * @throws Exception */ /*private void processAttachments(Element eleRes, Forum forum, Document document, String unZippedDirPath, int postId) throws Exception { int total_files = 0; long totalSize = 0; int userId = SessionFacade.getUserSession().getUserId(); AttachmentDAO am = DataAccessDriver.getInstance().newAttachmentDAO(); Map extensions = am.extensionsForSecurity(); // resource elements - <file> List resElements = eleRes.elements(); Attribute resHrefAttr = eleRes.attribute("href"); for (Iterator iter = resElements.iterator(); iter.hasNext();) { Element element = (Element) iter.next(); if (element.getQualifiedName().equalsIgnoreCase("file")) { Attribute hrefAttr = element.attribute("href"); // if (total_files >= SystemGlobals.getIntValue(ConfigKeys.ATTACHMENTS_MAX_POST)) if (total_files >= SakaiSystemGlobals.getIntValue(ConfigKeys.ATTACHMENTS_MAX_POST)) { if (logger.isWarnEnabled()) logger.warn("Total number of files attached exceeding maximum " + "allowed.... for site : " + ToolManager.getCurrentPlacement().getContext() + " - and for forum : " + forum.getName()); return; } String fileext = hrefAttr.getValue().trim().substring(hrefAttr.getValue().trim().lastIndexOf('.') + 1); // if (!fileext.equalsIgnoreCase("html")){ if (!hrefAttr.getValue().trim().equalsIgnoreCase(resHrefAttr.getValue().trim())) { // create as attachment try { // if (logger.isDebugEnabled()) // logger.debug("extensions.entrySet() : "+ // extensions.entrySet()); // Check if the extension is allowed if (extensions.containsKey(fileext)) { if (!((Boolean) extensions.get(fileext)).booleanValue()) { throw new BadExtensionException(I18n.getMessage("Attachments.badExtension", new String[] { fileext })); } } else { if (logger.isWarnEnabled()) logger.warn("site - " + ToolManager.getCurrentPlacement().getContext() + " - Attachment with this extension '" + fileext + "' is not allowed "); continue; } } catch (BadExtensionException e) { if (logger.isWarnEnabled()) logger.warn("site - " + ToolManager.getCurrentPlacement().getContext() + " - " + e.toString()); continue; } Attachment a = new Attachment(); a.setUserId(userId); AttachmentInfo info = new AttachmentInfo(); File attachmentFile = new File(unZippedDirPath + File.separator + hrefAttr.getValue()); if (!attachmentFile.exists()) { if (logger.isErrorEnabled()) logger.error("Error while import for site - " + ToolManager.getCurrentPlacement().getContext() + " - Attachment : " + attachmentFile.getAbsolutePath() + " doesn't exist."); continue; } try { // Check for total attachments size limit // long quotaSize = SystemGlobals.getIntValue(ConfigKeys.ATTACHMENTS_QUOTA_LIMIT) * 1024 * 1024; long quotaSize = SakaiSystemGlobals.getIntValue(ConfigKeys.ATTACHMENTS_QUOTA_LIMIT) * 1024 * 1024; totalSize = totalSize + attachmentFile.length(); if (quotaSize < totalSize) { throw new AttachmentSizeTooBigException(I18n.getMessage("Attachments.tooBig", new Integer[] { new Integer((int) quotaSize / 1024), new Integer((int) totalSize / 1024) })); } } catch (AttachmentSizeTooBigException e) { if (logger.isWarnEnabled()) logger.warn("site - " + ToolManager.getCurrentPlacement().getContext() + " - " + e.toString()); break; } info.setFilesize(attachmentFile.length()); info.setComment(""); info.setMimetype(""); // description List genElements = element.selectNodes("./imsmd:lom/imsmd:general"); if (genElements != null && genElements.size() > 0) { Element generalElement = (Element) genElements.get(0); Element descElement = generalElement.element("description"); String description = descElement.selectSingleNode(".//imsmd:langstring").getText(); if (description != null) info.setComment(description.trim()); } String filename = null; String hrefVal = hrefAttr.getValue().trim(); if (hrefVal.lastIndexOf('/') != -1) filename = hrefVal.substring(hrefVal.lastIndexOf('/') + 1); else if (hrefVal.lastIndexOf('\\') != -1) filename = hrefVal.substring(hrefVal.lastIndexOf('\\') + 1); if (filename.startsWith("post_")) filename = filename.substring(filename.indexOf("_", 5) + 1); info.setRealFilename(filename); info.setUploadTimeInMillis(System.currentTimeMillis()); AttachmentExtension ext = am.selectExtension(fileext); info.setExtension(ext); String savePath = makeStoreFilename(info); info.setPhysicalFilename(savePath); a.setInfo(info); a.setPostId(postId); // String path = SystemGlobals.getValue(ConfigKeys.ATTACHMENTS_STORE_DIR) + "/" + a.getInfo().getPhysicalFilename(); String path = SakaiSystemGlobals.getValue(ConfigKeys.ATTACHMENTS_STORE_DIR) + "/" + a.getInfo().getPhysicalFilename(); am.addAttachment(a); saveAttachmentFile(path, attachmentFile); total_files++; } } } }*/ protected void processAttachments(Element eleRes, Document document, String unZippedDirPath, org.etudes.api.app.jforum.Post post, JForumPostService jforumPostService) throws Exception { // resource elements - <file> List resElements = eleRes.elements(); Attribute resHrefAttr = eleRes.attribute("href"); for (Iterator iter = resElements.iterator(); iter.hasNext();) { Element element = (Element) iter.next(); if (element.getQualifiedName().equalsIgnoreCase("file")) { Attribute hrefAttr = element.attribute("href"); String fileext = hrefAttr.getValue().trim() .substring(hrefAttr.getValue().trim().lastIndexOf('.') + 1); if (!hrefAttr.getValue().trim().equalsIgnoreCase(resHrefAttr.getValue().trim())) { File attachmentFile = new File(unZippedDirPath + File.separator + hrefAttr.getValue()); if (!attachmentFile.exists()) { if (logger.isErrorEnabled()) { logger.error("Error while import for site - " + ToolManager.getCurrentPlacement().getContext() + " - Attachment : " + attachmentFile.getAbsolutePath() + " doesn't exist."); } continue; } // String fileName = null; String contentType = null; String comments = null; byte[] fileContent = null; // description List genElements = element.selectNodes("./imsmd:lom/imsmd:general"); if (genElements != null && genElements.size() > 0) { Element generalElement = (Element) genElements.get(0); Element descElement = generalElement.element("description"); String description = descElement.selectSingleNode(".//imsmd:langstring").getText(); if (description != null) { comments = description.trim(); } } String fileName = null; String hrefVal = hrefAttr.getValue().trim(); if (hrefVal.lastIndexOf('/') != -1) fileName = hrefVal.substring(hrefVal.lastIndexOf('/') + 1); else if (hrefVal.lastIndexOf('\\') != -1) fileName = hrefVal.substring(hrefVal.lastIndexOf('\\') + 1); if (fileName.startsWith("post_")) fileName = fileName.substring(fileName.indexOf("_", 5) + 1); //contentType = new MimetypesFileTypeMap().getContentType(attachmentFile); FileNameMap fileNameMap = URLConnection.getFileNameMap(); contentType = fileNameMap.getContentTypeFor(fileName); fileContent = getBytesFromFile(attachmentFile); org.etudes.api.app.jforum.Attachment attachment = jforumPostService.newAttachment(fileName, contentType, comments, fileContent); if (attachment != null) { post.getAttachments().add(attachment); post.setHasAttachments(true); } } } } }
From source file:org.olat.ims.qti.export.helper.ItemWithResponseStr.java
License:Apache License
/** * Constructor for ItemWithResponseLid.// www .j a v a 2 s .com * * @param el_item */ public ItemWithResponseStr(final Element el_item) { // CELFI#107 this.itemTitle = el_item.attributeValue("title"); this.itemIdent = el_item.attributeValue("ident"); final Element decvar = (Element) el_item.selectSingleNode(".//outcomes/decvar"); if (decvar != null) { this.itemMinValue = decvar.attributeValue("minvalue"); this.itemMaxValue = decvar.attributeValue("maxvalue"); this.itemCutValue = decvar.attributeValue("cutvalue"); } final List el_presentationElements = el_item .selectNodes(".//presentation//mattext | .//presentation//response_str"); int i = 1; boolean lastWasMattext = false; for (final Iterator itPresentations = el_presentationElements.iterator(); itPresentations.hasNext();) { final Element el_presentation = (Element) itPresentations.next(); final String el_qname = el_presentation.getQualifiedName(); if (el_qname.equalsIgnoreCase("mattext")) { this.quetionText += el_presentation.getTextTrim(); lastWasMattext = true; } else { responseStrIdents.add(el_presentation.attributeValue("ident")); final Element render_fib = el_presentation.element("render_fib"); if (render_fib != null) { isEssay = (render_fib.attributeValue("rows") == null) ? false : true; responseColumnHeaders.add((isEssay ? "A" : "B") + i); // A -> Area, B -> Blank final Element responseValue = (Element) el_item.selectSingleNode( ".//varequal[@respident='" + el_presentation.attributeValue("ident") + "']"); if (responseValue != null) { responseLabelMaterials.add(responseValue.getTextTrim()); if (lastWasMattext) { this.quetionText += " [" + responseValue.getTextTrim() + "] "; lastWasMattext = false; } } else { responseLabelMaterials.add(""); } } else { responseColumnHeaders.add("unknownType"); responseLabelMaterials.add(""); } i++; } } // CELFI#107 END }
From source file:org.openflexo.docxparser.OpenXml2Html.java
License:Open Source License
private ParsedHtml getHtmlFromW_PElement(Element element) throws InvalidElementException { if (OpenXmlTag.getOpenXmlTag(element) != OpenXmlTag.w_p) { throw new InvalidElementException("Cannot transform element to html, expecting element w:p and get '" + element.getQualifiedName() + "'"); }/* w w w . j a v a 2s .c om*/ Element numPrElement = (Element) element.selectSingleNode("w:pPr/w:numPr"); String foundNumId = null; Integer foundNumLevel = null; if (numPrElement != null) { Element ilvlElement = numPrElement.element(DocxQName.getQName(OpenXmlTag.w_ilvl)); Element numIdElement = numPrElement.element(DocxQName.getQName(OpenXmlTag.w_numId)); if (ilvlElement != null && numIdElement != null) { try { foundNumLevel = new Integer(ilvlElement.attributeValue(DocxQName.getQName(OpenXmlTag.w_val))); foundNumId = numIdElement.attributeValue(DocxQName.getQName(OpenXmlTag.w_val)); } catch (NumberFormatException e) { } } } ParsedHtml parsedHtml = new ParsedHtml(); currentParagraphProperties = new HTMLProperties(element); if (foundNumId != null || foundNumLevel != null || element.selectSingleNode("w:pPr/w:pStyle[@w:val = 'ListParagraph']") == null) { handleNumberingLevel(parsedHtml, foundNumId, foundNumLevel); } parsedHtml.appendHtml(currentParagraphProperties.getOpenTag()); for (Iterator<?> iterator = element.elementIterator(); iterator.hasNext();) { Element childElement = (Element) iterator.next(); parsedHtml.append(getRecursiveHtml(childElement)); } closeOpenedSpan(parsedHtml); parsedHtml.appendHtml(currentParagraphProperties.getCloseTag()); return parsedHtml; }
From source file:org.openflexo.docxparser.OpenXml2Html.java
License:Open Source License
private ParsedHtml getHtmlFromW_HyperlinkElement(Element element) throws InvalidElementException { if (OpenXmlTag.getOpenXmlTag(element) != OpenXmlTag.w_hyperlink) { throw new InvalidElementException( "Cannot transform element to html, expecting element w:hyperlink and get '" + element.getQualifiedName() + "'"); }/*from w w w . java 2s . com*/ ParsedHtml parsedHtml = new ParsedHtml(); String href = null; String linkRid = element.attributeValue(DocxQName.getQName(OpenXmlTag.r_id)); if (linkRid != null) { PackageRelationship linkRelationship = documentPart.getRelationship(linkRid); if (linkRelationship != null) { href = linkRelationship.getTargetURI().toString(); } } if (href == null) { // Anchor ? String anchor = element.attributeValue(DocxQName.getQName(OpenXmlTag.w_anchor)); if (anchor != null) { href = "#" + anchor; } } String closeTag; if (href != null) { String target = element.attributeValue(DocxQName.getQName(OpenXmlTag.w_tgtFrame)); String title = element.attributeValue(DocxQName.getQName(OpenXmlTag.w_tooltip)); parsedHtml.appendHtml("<a href=\"" + href + "\""); if (target != null) { parsedHtml.appendHtml(" target=\"" + StringEscapeUtils.escapeHtml(target) + "\""); } if (title != null) { parsedHtml.appendHtml(" title=\"" + StringEscapeUtils.escapeHtml(title) + "\""); } parsedHtml.appendHtml(">"); closeTag = "</a>"; } else { logger.log(Level.WARNING, "OpenXml to Html: cannot get hyperlink relationship with id '" + linkRid + "'"); closeTag = ""; } for (Iterator<?> iterator = element.elementIterator(); iterator.hasNext();) { Element childElement = (Element) iterator.next(); parsedHtml.append(getRecursiveHtml(childElement)); } parsedHtml.appendHtml(closeTag); return parsedHtml; }
From source file:org.openflexo.docxparser.OpenXml2Html.java
License:Open Source License
private ParsedHtml getHtmlFromW_RElement(Element element) throws InvalidElementException { if (OpenXmlTag.getOpenXmlTag(element) != OpenXmlTag.w_r) { throw new InvalidElementException("Cannot transform element to html, expecting element w:r and get '" + element.getQualifiedName() + "'"); }/*from w w w . j a v a 2 s. co m*/ ParsedHtml parsedHtml = new ParsedHtml(); HTMLProperties elementHTMLProperties = new HTMLProperties(element); elementHTMLProperties.removePropertiesFrom(currentParagraphProperties); if (!elementHTMLProperties.equals(currentSpanProperties)) { closeOpenedSpan(parsedHtml); currentSpanProperties = elementHTMLProperties; if (!currentSpanProperties.isEmpty()) { parsedHtml.appendHtml(currentSpanProperties.getOpenTag()); } } for (Iterator<?> iterator = element.elementIterator(); iterator.hasNext();) { Element childElement = (Element) iterator.next(); parsedHtml.append(getRecursiveHtml(childElement)); } return parsedHtml; }