Tika - Is it possible to get the id attribute of a div tag?
===

Is it possible to filter what tika parses by the id attribute of div tags in the html?

I am trying to filter out divs with the id "header" because all the pages i am parsing have the same header and I only need the unique data.

I have already triggered the ContentHandler.StartElement for the div tags:

    class MyHtmlMapper extends DefaultHtmlMapper {
	    public String mapSafeElement(String name) {
			if ("DIV".equals(name)) {
				return "div";
			}
			return super.mapSafeElement(name);
		}
	}

And I create the parser with the following:

    InputStream urlInput = new URL(url).openStream();
    Parser parser = new AutoDetectParser();
    Metadata metadata = new Metadata();
    ContentHandler handler = new BodyContentHandler();
    ParseContext context = new ParseContext();
    context.set(HtmlMapper.class, new MyHtmlMapper());

So I am assuming I have to override the BodyContentHandler.startElement() and BodyContentHandler.endElement() methods in the data handler (Something like the following):

    class MyContnentHandler extends BodyContentHandler{
        public void startElement(String uri, String name, String element, Attributes atri) {
            ... 
            super.startElement(...)
        }
        public void endElement(...)
            ... //Similar to above
        }
    }

I've been working on this for a little while and I'm just not terribly familiar with tika. If anyone has any suggestions or solutions they'd be greatly apprecieated!

Let me know if I've left out any information that would be useful.

~ Bacaa14