001package org.hl7.fhir.utilities.xhtml; 002 003public class XhtmlUtils { 004 005 public static String convertHtmlToText(String source, String desc) { 006 try { 007 XhtmlDocument doc = new XhtmlParser().parse(source, "html"); 008 return doc.getDocumentElement().allText(); 009 } catch (Exception e) { 010 // todo - should we try another way? 011 System.err.println("XHTML content could not be parsed from "+desc); 012 e.printStackTrace(); 013 System.err.println(source); 014 return "Unparseable HTML"; 015 } 016 } 017 018}