System.setProperty("javax.xml.parsers.SAXParserFactory", "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl"); SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); factory.newSAXParser().parse( new InputSource(new StringReader( "<html><head><title>this is title</title></head><body>this is body</body></html>")), new DefaultHandler()); } }