static JSONArray parseFirstEntries(final InputStream inputStream, final int count) throws ExecutionException, InterruptedException
    {
        final SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.ENGLISH);

        final JSONArray result = new JSONArray();

        final Document document = SAXReaderUtil.readDocument(inputStream);
        final List<Node> nodes = document.selectNodes("/rss/channel/item");
        for (final Node node : nodes) {
            if (!(node instanceof Element)) {
                continue;
            }

            try {
                final Element item = (Element) node;

                final JSONObject o = new JSONObject();
                o.put("link", item.elementText("link"));
                o.put("title", item.elementText("title"));
                o.put("date", JiveGlobals.formatDate(dateFormat.parse(item.elementText("pubDate"))));
                result.put(o);
            } catch (Exception e) {
                Log.debug("Unable to parse element as RSS data: {}", node.asXML(), e);
            }

            if (result.length() >= count) {
                break;
            }
        }
        return result;
    }
Parses the input stream, expected to contain RSS data, into the proprietary format used by the admin console.

@param inputStream An input stream of RSS data
@param count The maximum number of items to return.
@return A collection or RSS items.
xmppserver/src/main/java/org/jivesoftware/admin/servlet/BlogPostServlet.java