MyIXMLBuilderAdapter (CharSequence text, boolean stopIfAccepted) { StdXMLReader reader = new StdXMLReader(CharArrayUtil.readerFromCharSequence(text)) { @Override public Reader openStream(String publicID, String systemID) throws IOException { if (!HTTP_JAVA_SUN_COM_DTD_PROPERTIES_DTD.equals(systemID)) throw new IOException(); return new StringReader(" "); } }; MyIXMLBuilderAdapter builder = new MyIXMLBuilderAdapter(stopIfAccepted); NanoXmlUtil.parse(reader, builder); return builder; }