Code example for InputSource

0
 
   public static Document parse(String html) throws SAXException, IOException {
      XMLReader saxReader = getParser();
      GwtXmlContentHandler contentHandler = new GwtXmlContentHandler();
      saxReader.setContentHandler(contentHandler);
      saxReader.parse(new InputSource(new StringReader(html)));
 
      return contentHandler.getParsedDocument();
   } 
 
   private static XMLReader getParser() {
      if (PARSER == null) {
         PARSER = XmlUtils.newXMLReader();
      } 
 
      return PARSER;
 
   } 
 
}