WARN/ExpatReader(222): DTD handlers aren't supported
<p>I am using SAXParser for parsing the xml data received from server.
I have created the abstract class XmlParser extends DefaultHandler with abstract methods characters(),startelement(),endelement().I have encountered this issue(WARN/ExpatReader(718): DTD handlers aren't supported.)My PArsing stops in the middle.I have referred some answers suggested to follow the below code
My code</p>

<pre><code>public abstract class XmlParser extends DefaultHandler {

public XmlParser(final String xmlData) {
    parseDocument(xmlData);
}

@Override
public abstract void characters(char[] ch, int start, int length)
    throws SAXException;

@Override
public abstract void endElement(String uri, String localName, String qName)
    throws SAXException;

private void parseDocument(final String xmlData) {
    SAXParserFactory spf = SAXParserFactory.newInstance();

    try {
        SAXParser sp = spf.newSAXParser();
        InputStream is = new ByteArrayInputStream(xmlData.getBytes("UTF-8"));&lt;----I think i have to change here
        sp.parse(is, this);
    } catch (SAXException ex) {
        ex.printStackTrace();
    } catch (ParserConfigurationException ex) {
        ex.printStackTrace();
    } catch (IOException ex) {
        ex.printStackTrace();
    }
}

@Override
public abstract void startElement(String uri, String localName,
    String qName, Attributes attributes) throws SAXException;   
</code></pre>

<p>}</p>

<p>Referred answer</p>

<p>XMLReader xmlReader = SAXParserFactory.newInstance().newSAXParser().getXMLReader();
xmlReader.setContentHandler(//YourHandler extends DefaultHandler);
xmlReader.parse(new InputSource(//BufferedReader));</p>

<p>problem for me
i have an abstract class that extends defaulthandler.
I cant create a object for it to pass in setContentHandler() method.
I should keep this XmlParser as abstract since i have to override for each module parser
So suggest me a solution to overcome this issue</p>
