List of usage examples for org.dom4j Node ELEMENT_NODE
short ELEMENT_NODE
To view the source code for org.dom4j Node ELEMENT_NODE.
Click Source Link
From source file:org.dommons.dom.dom4j.XDom4jNode.java
License:Open Source License
public List<XElement> elements() { List<XElement> list = new ArrayList(); for (Iterator<Node> it = target().nodeIterator(); it.hasNext();) { Node node = it.next();/*from ww w . ja v a 2s . c o m*/ if (node.getNodeType() == Node.ELEMENT_NODE) list.add(new XDom4jElement((Element) node)); } return list; }
From source file:org.dommons.dom.dom4j.XDom4jNode.java
License:Open Source License
public List<XElement> elements(String... names) { Branch ele = element(names, 0, -1);//ww w .j a v a2s .com List<XElement> list = new ArrayList(); if (ele != null) { for (Iterator<Node> it = ele.nodeIterator(); it.hasNext();) { Node node = it.next(); if (node.getNodeType() == Node.ELEMENT_NODE && names[names.length - 1].equals(node.getName())) list.add(new XDom4jElement((Element) node)); } } return list; }
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;/*from www. java2 s. co 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.hudsonci.xpath.impl.Dom2Dom.java
License:Open Source License
private org.w3c.dom.Node createChild(Node child, org.w3c.dom.Node wparent) { int type = child.getNodeType(); // Collapse multiple consecutive text nodes to a single text node // with trimmed value. if (type != Node.TEXT_NODE) endText(wparent);// w w w . j a v a 2s. co m Name name; org.w3c.dom.Node node = null; switch (type) { case Node.ATTRIBUTE_NODE: break; case Node.CDATA_SECTION_NODE: CDATA cd = (CDATA) child; wparent.appendChild(node = wdoc.createCDATASection(cd.getText())); break; case Node.COMMENT_NODE: Comment co = (Comment) child; wparent.appendChild(node = wdoc.createComment(co.getText())); break; case Node.DOCUMENT_TYPE_NODE: DocumentType dt = (DocumentType) child; wparent.appendChild(new XDocumentType(dt, wparent)); break; case Node.ELEMENT_NODE: Element el = (Element) child; name = new Name(el); org.w3c.dom.Element e = name.namespaceURI == null ? wdoc.createElement(name.qualifiedName) : wdoc.createElementNS(name.namespaceURI, name.qualifiedName); wparent.appendChild(e); node = currentElement = e; for (int i = 0, n = el.attributeCount(); i < n; i++) { Attribute at = el.attribute(i); name = new Name(at); if (name.namespaceURI == null) e.setAttribute(name.qualifiedName, at.getValue()); else e.setAttributeNS(name.namespaceURI, name.qualifiedName, at.getValue()); } return e; case Node.ENTITY_REFERENCE_NODE: break; case Node.PROCESSING_INSTRUCTION_NODE: ProcessingInstruction p = (ProcessingInstruction) child; wparent.appendChild(node = wdoc.createProcessingInstruction(p.getTarget(), p.getText())); break; case Node.TEXT_NODE: textBuilder.append(child.getText()); lastText = (Text) child; break; case Node.NAMESPACE_NODE: Namespace ns = (Namespace) child; name = new Name(ns); currentElement.setAttribute(name.qualifiedName, ns.getURI()); break; default: throw new IllegalStateException("Unknown node type"); } if (node != null) reverseMap.put(node, child); return null; }
From source file:org.openadaptor.auxil.convertor.map.Dom4JDocumentMapFacade.java
License:Open Source License
/** * Extract value from a single node/*from ww w . j a va2 s . co m*/ * <br> * <UL> * <LI>If an Element return the element reference. * <LI>If an Attribute return the attribute value * <LI>If text (or CDATA) return it. * <LI>If null return null. * @param node Node from which to extract a value * @return Reference to Element, or String representation of value. */ private Object getSingleValuedResult(Node node) { Object result = null; switch (node.getNodeType()) { case Node.ELEMENT_NODE: result = (Element) node; break; case Node.ATTRIBUTE_NODE: result = ((Attribute) node).getValue(); break; case Node.TEXT_NODE: case Node.CDATA_SECTION_NODE: //Not sure about this one! result = node.getText(); break; } return result; }
From source file:org.opencms.importexport.CmsXmlPageConverter.java
License:Open Source License
/** * Converts the contents of a page into an xml page.<p> * /*from w w w . j av a 2s. c o m*/ * @param cms the cms object * @param content the content used with xml templates * @param locale the locale of the body element(s) * @param encoding the encoding to the xml page * @return the xml page content or null if conversion failed * @throws CmsImportExportException if the body content or the XMLTEMPLATE element were not found * @throws CmsXmlException if there is an error reading xml contents from the byte array into a document */ public static CmsXmlPage convertToXmlPage(CmsObject cms, byte[] content, Locale locale, String encoding) throws CmsImportExportException, CmsXmlException { CmsXmlPage xmlPage = null; Document page = CmsXmlUtils.unmarshalHelper(content, null); Element xmltemplate = page.getRootElement(); if ((xmltemplate == null) || !"XMLTEMPLATE".equals(xmltemplate.getName())) { throw new CmsImportExportException(Messages.get().container(Messages.ERR_NOT_FOUND_ELEM_XMLTEMPLATE_0)); } // get all edittemplate nodes Iterator i = xmltemplate.elementIterator("edittemplate"); boolean useEditTemplates = true; if (!i.hasNext()) { // no edittemplate nodes found, get the template nodes i = xmltemplate.elementIterator("TEMPLATE"); useEditTemplates = false; } // now create the XML page xmlPage = new CmsXmlPage(locale, encoding); while (i.hasNext()) { Element currentTemplate = (Element) i.next(); String bodyName = currentTemplate.attributeValue("name"); if (CmsStringUtil.isEmpty(bodyName)) { // no template name found, use the parameter body name bodyName = "body"; } String bodyContent = null; if (useEditTemplates) { // no content manipulation needed for edittemplates bodyContent = currentTemplate.getText(); } else { // parse content for TEMPLATEs StringBuffer contentBuffer = new StringBuffer(); for (Iterator k = currentTemplate.nodeIterator(); k.hasNext();) { Node n = (Node) k.next(); if (n.getNodeType() == Node.CDATA_SECTION_NODE) { contentBuffer.append(n.getText()); continue; } else if (n.getNodeType() == Node.ELEMENT_NODE) { if ("LINK".equals(n.getName())) { contentBuffer.append(OpenCms.getSystemInfo().getOpenCmsContext()); contentBuffer.append(n.getText()); continue; } } } bodyContent = contentBuffer.toString(); } if (bodyContent == null) { throw new CmsImportExportException(Messages.get().container(Messages.ERR_BODY_CONTENT_NOT_FOUND_0)); } bodyContent = CmsStringUtil.substitute(bodyContent, CmsStringUtil.MACRO_OPENCMS_CONTEXT, OpenCms.getSystemInfo().getOpenCmsContext()); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(bodyContent)) { xmlPage.addValue(bodyName, locale); xmlPage.setStringValue(cms, bodyName, locale, bodyContent); } } return xmlPage; }
From source file:org.opencms.setup.xml.CmsSetupXmlHelper.java
License:Open Source License
/** * Sets the given value in all nodes identified by the given xpath of the given xml file.<p> * //from ww w . j a v a 2s. c o m * If value is <code>null</code>, all nodes identified by the given xpath will be deleted.<p> * * If the node identified by the given xpath does not exists, the missing nodes will be created * (if <code>value</code> not <code>null</code>).<p> * * @param document the xml document * @param xPath the xpath to set * @param value the value to set (can be <code>null</code> for deletion) * @param nodeToInsert optional, if given it will be inserted after xPath with the given value * * @return the number of successful changed or deleted nodes */ public static int setValue(Document document, String xPath, String value, String nodeToInsert) { int changes = 0; // be naive and try to find the node Iterator<Node> itNodes = CmsCollectionsGenericWrapper.<Node>list(document.selectNodes(xPath)).iterator(); // if not found if (!itNodes.hasNext()) { if (value == null) { // if no node found for deletion return 0; } // find the node creating missing nodes in the way Iterator<String> it = CmsStringUtil.splitAsList(xPath, "/", false).iterator(); Node currentNode = document; while (it.hasNext()) { String nodeName = it.next(); // if a string condition contains '/' while ((nodeName.indexOf("='") > 0) && (nodeName.indexOf("']") < 0)) { nodeName += "/" + it.next(); } Node node = currentNode.selectSingleNode(nodeName); if (node != null) { // node found currentNode = node; if (!it.hasNext()) { currentNode.setText(value); } } else if (currentNode.getNodeType() == Node.ELEMENT_NODE) { Element elem = (Element) currentNode; if (!nodeName.startsWith("@")) { elem = handleNode(elem, nodeName); if (!it.hasNext() && CmsStringUtil.isNotEmptyOrWhitespaceOnly(value)) { elem.setText(value); } } else { // if node is attribute create it with given value elem.addAttribute(nodeName.substring(1), value); } currentNode = elem; } else { // should never happen if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.ERR_XML_SET_VALUE_2, xPath, value)); } break; } } if (nodeToInsert == null) { // if not inserting we are done return 1; } // if inserting, we just created the insertion point, so continue itNodes = CmsCollectionsGenericWrapper.<Node>list(document.selectNodes(xPath)).iterator(); } // if found while (itNodes.hasNext()) { Node node = itNodes.next(); if (nodeToInsert == null) { // if not inserting if (value != null) { // if found, change the value node.setText(value); } else { // if node for deletion is found node.getParent().remove(node); } } else { // first create the node to insert Element parent = node.getParent(); Element elem = handleNode(parent, nodeToInsert); if (value != null) { elem.setText(value); } // get the parent element list List<Node> list = CmsCollectionsGenericWrapper.<Node>list(parent.content()); // remove the just created element list.remove(list.size() - 1); // insert it back to the right position int pos = list.indexOf(node); list.add(pos + 1, elem); // insert after } changes++; } return changes; }
From source file:org.opencms.util.ant.CmsSetupXmlHelper.java
License:Open Source License
/** * Sets the given value in all nodes identified by the given xpath of the given xml file.<p> * /*from w ww . j a v a2 s. c o m*/ * If value is <code>null</code>, all nodes identified by the given xpath will be deleted.<p> * * If the node identified by the given xpath does not exists, the missing nodes will be created * (if <code>value</code> not <code>null</code>).<p> * * @param document the xml document * @param xPath the xpath to set * @param value the value to set (can be <code>null</code> for deletion) * @param nodeToInsert optional, if given it will be inserted after xPath with the given value * * @return the number of successful changed or deleted nodes */ @SuppressWarnings("unchecked") public static int setValue(Document document, String xPath, String value, String nodeToInsert) { int changes = 0; // be naive and try to find the node Iterator<Node> itNodes = document.selectNodes(xPath).iterator(); // if not found if (!itNodes.hasNext()) { if (value == null) { // if no node found for deletion return 0; } // find the node creating missing nodes in the way Iterator<String> it = CmsStringUtil.splitAsList(xPath, "/", false).iterator(); Node currentNode = document; while (it.hasNext()) { String nodeName = it.next(); // if a string condition contains '/' while ((nodeName.indexOf("='") > 0) && (nodeName.indexOf("']") < 0)) { nodeName += "/" + it.next(); } Node node = currentNode.selectSingleNode(nodeName); if (node != null) { // node found currentNode = node; if (!it.hasNext()) { currentNode.setText(value); } } else if (currentNode.getNodeType() == Node.ELEMENT_NODE) { Element elem = (Element) currentNode; if (!nodeName.startsWith("@")) { elem = handleNode(elem, nodeName); if (!it.hasNext() && !CmsStringUtil.isEmptyOrWhitespaceOnly(value)) { elem.setText(value); } } else { // if node is attribute create it with given value elem.addAttribute(nodeName.substring(1), value); } currentNode = elem; } else { // should never happen break; } } if (nodeToInsert == null) { // if not inserting we are done return 1; } // if inserting, we just created the insertion point, so continue itNodes = document.selectNodes(xPath).iterator(); } // if found while (itNodes.hasNext()) { Node node = itNodes.next(); if (nodeToInsert == null) { // if not inserting if (value != null) { // if found, change the value node.setText(value); } else { // if node for deletion is found node.getParent().remove(node); } } else { // first create the node to insert Element parent = node.getParent(); Element elem = handleNode(parent, nodeToInsert); if (value != null) { elem.setText(value); } // get the parent element list List<Node> list = parent.content(); // remove the just created element list.remove(list.size() - 1); // insert it back to the right position int pos = list.indexOf(node); list.add(pos + 1, elem); // insert after } changes++; } return changes; }
From source file:org.opencms.webdav.CmsWebdavServlet.java
License:Open Source License
/** * Process a LOCK WebDAV request for the specified resource.<p> * //from ww w.j a v a2 s . com * @param req the servlet request we are processing * @param resp the servlet response we are creating * * @throws IOException if an input/output error occurs */ @SuppressWarnings("unchecked") protected void doLock(HttpServletRequest req, HttpServletResponse resp) throws IOException { String path = getRelativePath(req); // Check if webdav is set to read only if (m_readOnly) { resp.setStatus(CmsWebdavStatus.SC_FORBIDDEN); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_WEBDAV_READ_ONLY_0)); } return; } // Check if resource is locked if (isLocked(req)) { resp.setStatus(CmsWebdavStatus.SC_LOCKED); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_ITEM_LOCKED_1, path)); } return; } CmsRepositoryLockInfo lock = new CmsRepositoryLockInfo(); // Parsing depth header String depthStr = req.getHeader(HEADER_DEPTH); if (depthStr == null) { lock.setDepth(CmsRepositoryLockInfo.DEPTH_INFINITY_VALUE); } else { if (depthStr.equals("0")) { lock.setDepth(0); } else { lock.setDepth(CmsRepositoryLockInfo.DEPTH_INFINITY_VALUE); } } // Parsing timeout header int lockDuration = CmsRepositoryLockInfo.TIMEOUT_INFINITE_VALUE; lock.setExpiresAt(System.currentTimeMillis() + (lockDuration * 1000)); int lockRequestType = LOCK_CREATION; Element lockInfoNode = null; try { SAXReader saxReader = new SAXReader(); Document document = saxReader.read(new InputSource(req.getInputStream())); // Get the root element of the document Element rootElement = document.getRootElement(); lockInfoNode = rootElement; } catch (Exception e) { lockRequestType = LOCK_REFRESH; } if (lockInfoNode != null) { // Reading lock information Iterator<Element> iter = lockInfoNode.elementIterator(); Element lockScopeNode = null; Element lockTypeNode = null; Element lockOwnerNode = null; while (iter.hasNext()) { Element currentElem = iter.next(); switch (currentElem.getNodeType()) { case Node.TEXT_NODE: break; case Node.ELEMENT_NODE: String nodeName = currentElem.getName(); if (nodeName.endsWith(TAG_LOCKSCOPE)) { lockScopeNode = currentElem; } if (nodeName.endsWith(TAG_LOCKTYPE)) { lockTypeNode = currentElem; } if (nodeName.endsWith(TAG_OWNER)) { lockOwnerNode = currentElem; } break; default: break; } } if (lockScopeNode != null) { iter = lockScopeNode.elementIterator(); while (iter.hasNext()) { Element currentElem = iter.next(); switch (currentElem.getNodeType()) { case Node.TEXT_NODE: break; case Node.ELEMENT_NODE: String tempScope = currentElem.getName(); if (tempScope.indexOf(':') != -1) { lock.setScope(tempScope.substring(tempScope.indexOf(':') + 1)); } else { lock.setScope(tempScope); } break; default: break; } } if (lock.getScope() == null) { // Bad request resp.setStatus(CmsWebdavStatus.SC_BAD_REQUEST); } } else { // Bad request resp.setStatus(CmsWebdavStatus.SC_BAD_REQUEST); } if (lockTypeNode != null) { iter = lockTypeNode.elementIterator(); while (iter.hasNext()) { Element currentElem = iter.next(); switch (currentElem.getNodeType()) { case Node.TEXT_NODE: break; case Node.ELEMENT_NODE: String tempType = currentElem.getName(); if (tempType.indexOf(':') != -1) { lock.setType(tempType.substring(tempType.indexOf(':') + 1)); } else { lock.setType(tempType); } break; default: break; } } if (lock.getType() == null) { // Bad request resp.setStatus(CmsWebdavStatus.SC_BAD_REQUEST); } } else { // Bad request resp.setStatus(CmsWebdavStatus.SC_BAD_REQUEST); } if (lockOwnerNode != null) { iter = lockOwnerNode.elementIterator(); while (iter.hasNext()) { Element currentElem = iter.next(); switch (currentElem.getNodeType()) { case Node.TEXT_NODE: lock.setOwner(lock.getOwner() + currentElem.getStringValue()); break; case Node.ELEMENT_NODE: lock.setOwner(lock.getOwner() + currentElem.getStringValue()); break; default: break; } } if (lock.getOwner() == null) { // Bad request resp.setStatus(CmsWebdavStatus.SC_BAD_REQUEST); } } else { lock.setOwner(""); } } lock.setPath(path); lock.setUsername(m_username); if (lockRequestType == LOCK_REFRESH) { CmsRepositoryLockInfo currentLock = m_session.getLock(path); if (currentLock == null) { lockRequestType = LOCK_CREATION; } } if (lockRequestType == LOCK_CREATION) { try { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_LOCK_ITEM_1, lock.getOwner())); } boolean result = m_session.lock(path, lock); if (result) { // Add the Lock-Token header as by RFC 2518 8.10.1 // - only do this for newly created locks resp.addHeader(HEADER_LOCKTOKEN, "<opaquelocktoken:" + generateLockToken(req, lock) + ">"); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_LOCK_ITEM_FAILED_0)); } } else { resp.setStatus(CmsWebdavStatus.SC_LOCKED); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_LOCK_ITEM_SUCCESS_0)); } return; } } catch (CmsVfsResourceNotFoundException rnfex) { resp.setStatus(CmsWebdavStatus.SC_NOT_FOUND); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_ITEM_NOT_FOUND_1, path)); } return; } catch (CmsSecurityException sex) { resp.setStatus(CmsWebdavStatus.SC_FORBIDDEN); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_NO_PERMISSION_0)); } return; } catch (CmsException ex) { resp.setStatus(CmsWebdavStatus.SC_INTERNAL_SERVER_ERROR); if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.LOG_REPOSITORY_ERROR_2, "LOCK", path), ex); } return; } } // Set the status, then generate the XML response containing // the lock information Document doc = DocumentHelper.createDocument(); Element propElem = doc.addElement(new QName(TAG_PROP, Namespace.get(DEFAULT_NAMESPACE))); Element lockElem = addElement(propElem, TAG_LOCKDISCOVERY); addLockElement(lock, lockElem, generateLockToken(req, lock)); resp.setStatus(CmsWebdavStatus.SC_OK); resp.setContentType("text/xml; charset=UTF-8"); Writer writer = resp.getWriter(); doc.write(writer); writer.close(); }
From source file:org.opencms.webdav.CmsWebdavServlet.java
License:Open Source License
/** * Process a PROPFIND WebDAV request for the specified resource.<p> * /*from w w w . ja va 2s.c o m*/ * @param req the servlet request we are processing * @param resp the servlet response we are creating * * @throws IOException if an input/output error occurs */ protected void doPropfind(HttpServletRequest req, HttpServletResponse resp) throws IOException { String path = getRelativePath(req); if (!m_listings) { // Get allowed methods StringBuffer methodsAllowed = determineMethodsAllowed(getRelativePath(req)); resp.addHeader(HEADER_ALLOW, methodsAllowed.toString()); resp.setStatus(CmsWebdavStatus.SC_METHOD_NOT_ALLOWED); return; } // Properties which are to be displayed. List<String> properties = new Vector<String>(); // Propfind depth int depth = CmsRepositoryLockInfo.DEPTH_INFINITY_VALUE; // Propfind type int type = FIND_ALL_PROP; String depthStr = req.getHeader(HEADER_DEPTH); if (depthStr == null) { depth = CmsRepositoryLockInfo.DEPTH_INFINITY_VALUE; } else { if (depthStr.equals("0")) { depth = 0; } else if (depthStr.equals("1")) { depth = 1; } else if (depthStr.equalsIgnoreCase(DEPTH_INFINITY)) { depth = CmsRepositoryLockInfo.DEPTH_INFINITY_VALUE; } } Element propNode = null; try { SAXReader saxReader = new SAXReader(); Document document = saxReader.read(req.getInputStream()); // Get the root element of the document Element rootElement = document.getRootElement(); @SuppressWarnings("unchecked") Iterator<Element> iter = rootElement.elementIterator(); while (iter.hasNext()) { Element currentElem = iter.next(); switch (currentElem.getNodeType()) { case Node.TEXT_NODE: break; case Node.ELEMENT_NODE: if (currentElem.getName().endsWith("prop")) { type = FIND_BY_PROPERTY; propNode = currentElem; } if (currentElem.getName().endsWith("propname")) { type = FIND_PROPERTY_NAMES; } if (currentElem.getName().endsWith("allprop")) { type = FIND_ALL_PROP; } break; default: break; } } } catch (Exception e) { // Most likely there was no content : we use the defaults. } if (propNode != null) { if (type == FIND_BY_PROPERTY) { @SuppressWarnings("unchecked") Iterator<Element> iter = propNode.elementIterator(); while (iter.hasNext()) { Element currentElem = iter.next(); switch (currentElem.getNodeType()) { case Node.TEXT_NODE: break; case Node.ELEMENT_NODE: String nodeName = currentElem.getName(); String propertyName = null; if (nodeName.indexOf(':') != -1) { propertyName = nodeName.substring(nodeName.indexOf(':') + 1); } else { propertyName = nodeName; } // href is a live property which is handled differently properties.add(propertyName); break; default: break; } } } } boolean exists = m_session.exists(path); if (!exists) { resp.setStatus(CmsWebdavStatus.SC_NOT_FOUND); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_ITEM_NOT_FOUND_1, path)); } return; } I_CmsRepositoryItem item = null; try { item = m_session.getItem(path); } catch (CmsException e) { resp.setStatus(CmsWebdavStatus.SC_NOT_FOUND); return; } resp.setStatus(CmsWebdavStatus.SC_MULTI_STATUS); resp.setContentType("text/xml; charset=UTF-8"); // Create multistatus object Document doc = DocumentHelper.createDocument(); Element multiStatusElem = doc.addElement(new QName(TAG_MULTISTATUS, Namespace.get("D", DEFAULT_NAMESPACE))); if (depth == 0) { parseProperties(req, multiStatusElem, item, type, properties); } else { // The stack always contains the object of the current level Stack<I_CmsRepositoryItem> stack = new Stack<I_CmsRepositoryItem>(); stack.push(item); // Stack of the objects one level below Stack<I_CmsRepositoryItem> stackBelow = new Stack<I_CmsRepositoryItem>(); while ((!stack.isEmpty()) && (depth >= 0)) { I_CmsRepositoryItem currentItem = stack.pop(); parseProperties(req, multiStatusElem, currentItem, type, properties); if ((currentItem.isCollection()) && (depth > 0)) { try { List<I_CmsRepositoryItem> list = m_session.list(currentItem.getName()); Iterator<I_CmsRepositoryItem> iter = list.iterator(); while (iter.hasNext()) { I_CmsRepositoryItem element = iter.next(); stackBelow.push(element); } } catch (CmsException e) { resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); if (LOG.isErrorEnabled()) { LOG.error(Messages.get().getBundle().key(Messages.LOG_LIST_ITEMS_ERROR_1, currentItem.getName()), e); } return; } } if (stack.isEmpty()) { depth--; stack = stackBelow; stackBelow = new Stack<I_CmsRepositoryItem>(); } } } Writer writer = resp.getWriter(); doc.write(writer); writer.close(); }