public void parse(InputStream stream, ContentHandler handler, Metadata metadata,
                      ParseContext context) throws IOException, SAXException, TikaException {
        // set the encoding?
        try {
            SyndFeedInput input = new SyndFeedInput();
            input.setAllowDoctypes(false);
            SyndFeed feed =
                    input.build(new InputSource(CloseShieldInputStream.wrap(stream)));

            String title = stripTags(feed.getTitleEx());
            String description = stripTags(feed.getDescriptionEx());

            metadata.set(TikaCoreProperties.TITLE, title);
            metadata.set(TikaCoreProperties.DESCRIPTION, description);
            // store the other fields in the metadata

            XHTMLContentHandler xhtml = new XHTMLContentHandler(handler, metadata);
            xhtml.startDocument();

            xhtml.element("h1", title);
            xhtml.element("p", description);

            xhtml.startElement("ul");
            for (Object e : feed.getEntries()) {
                SyndEntry entry = (SyndEntry) e;
                String link = entry.getLink();
                if (link != null) {
                    xhtml.startElement("li");
                    xhtml.startElement("a", "href", link);
                    xhtml.characters(stripTags(entry.getTitleEx()));
                    xhtml.endElement("a");
                    SyndContent content = entry.getDescription();
                    if (content != null) {
                        xhtml.newline();
                        xhtml.characters(stripTags(content));
                    }
                    xhtml.endElement("li");
                }
            }
            xhtml.endElement("ul");

            xhtml.endDocument();
        } catch (FeedException e) {
            throw new TikaException("RSS parse error", e);
        }

    }
@Test
    public void testAtomParser() throws Exception {
        try (InputStream input = FeedParserTest.class
                .getResourceAsStream("/test-documents/testATOM.atom")) {
            Metadata metadata = new Metadata();
            ContentHandler handler = new BodyContentHandler();
            ParseContext context = new ParseContext();

            new FeedParser().parse(input, handler, metadata, context);

            String content = handler.toString();
            assertNotNull(content);

            assertEquals("Sample Atom File for Junit test",
                    metadata.get(TikaCoreProperties.DESCRIPTION));
            assertEquals("Test Atom Feed", metadata.get(TikaCoreProperties.TITLE));

            // TODO Check some more
        }
    }