/** * This will return all content for the <code>Document</code>. * The returned list is "live" in document order and changes to it * affect the document's actual content. * * <p> * Sequential traversal through the List is best done with a Iterator * since the underlying implement of List.size() may require walking the * entire list. * </p> * * @return <code>List</code> - all Document content * @throws IllegalStateException if the root element hasn't been set */ @Override public List<Content> getContent() { if (!hasRootElement()) throw new IllegalStateException("Root element not set"); return content; }
/** * Return a filtered view of this <code>Document</code>'s content. * * <p> * Sequential traversal through the List is best done with a Iterator * since the underlying implement of List.size() may require walking the * entire list. * </p> * * @param filter <code>Filter</code> to apply * @return <code>List</code> - filtered Document content * @throws IllegalStateException if the root element hasn't been set */ @Override public <F extends Content> List<F> getContent(Filter<F> filter) { if (!hasRootElement()) throw new IllegalStateException("Root element not set"); return content.getView(filter); }
Element rootElement = hasRootElement() ? getRootElement() : null ; if (rootElement != null) { stringForm.append("Root is ")
} catch (final SAXParseException e) { Document doc = saxHandler.getDocument(); if (doc.hasRootElement() == false) { doc = null;
List<Content> list = doc.hasRootElement() ? doc.getContent() : new ArrayList<Content>(doc.getContentSize()); if (list.isEmpty()) {
List<Content> list = doc.hasRootElement() ? doc.getContent() : new ArrayList<Content>(doc.getContentSize()); if (list.isEmpty()) {
List<Content> list = doc.hasRootElement() ? doc.getContent() : new ArrayList<Content>(doc.getContentSize()); if (list.isEmpty()) {
public static Response showMCRDerivate(String pathParamMcrID, String pathParamDerID, UriInfo info, Application app, boolean withDetails) throws MCRRestAPIException { MCRObjectID mcrObj = MCRObjectID.getInstance(pathParamMcrID); MCRDerivate derObj = retrieveMCRDerivate(mcrObj, pathParamDerID); try { Document doc = derObj.createXML(); if (withDetails) { Document docContent = listDerivateContentAsXML(derObj, "/", -1, info, app); if (docContent != null && docContent.hasRootElement()) { doc.getRootElement().addContent(docContent.getRootElement().detach()); } } StringWriter sw = new StringWriter(); XMLOutputter outputter = new XMLOutputter(Format.getPrettyFormat()); outputter.output(doc, sw); return Response.ok(sw.toString()) .type("application/xml") .build(); } catch (IOException e) { throw new MCRRestAPIException(Response.Status.INTERNAL_SERVER_ERROR, new MCRRestAPIError(MCRRestAPIError.CODE_INTERNAL_ERROR, GENERAL_ERROR_MSG, e.getMessage())); } // return MCRRestAPIError.create(Response.Status.INTERNAL_SERVER_ERROR, "Unexepected program flow termination.", // "Please contact a developer!").createHttpResponse(); }
if (classif.hasRootElement() && classif.getRootElement().getChildren().size() > 0) { MCRCategory category = MCRXMLTransformer.getCategory(classif);
Document docContents = listDerivateContentAsXML( MCRMetadataManager.retrieveMCRDerivate(MCRObjectID.getInstance(derID)), "/", -1, info, app); if (docContents.hasRootElement()) { eDer.addContent(docContents.getRootElement().detach());