Code example for XMLReader

Methods: parsesetContentHandler

0
   private static XMLReader PARSER;
 
   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;
 
   } 
 
Stop searching for code, let great code find you!  Add Codota to your java IDE