Use Unchecked JDOM Factory
import org.jdom.Document;
import org.jdom.UncheckedJDOMFactory;
import org.jdom.input.SAXBuilder;
import org.xml.sax.XMLReader;
import com.sun.org.apache.xerces.internal.parsers.XMLParser;
public class UncheckedFactorySample {
public static void main(String[] args) throws Exception {
SAXBuilder builder = new SAXBuilder();
builder.setFeature("http://xml.org/sax/features/validation", false);
builder.setFactory(new UncheckedJDOMFactory());
Document doc = builder.build("bad.xml");
System.out.println(doc.getRootElement().getName());
}
}
Related examples in the same category