javaxomentityresolver

Setting a custom XOM EntityResolver


I need to not validate against a doctype, so I'd like to set a custom EntityResolver that accepts everything. I'm getting data back from tagsoup, so I know my data is well-formed and correct.

Furthermore, I need to rapidly hit a number of documents, so when I do this with the default EntityResolver, I get 503 from w3.org.

How, then, can I use a XOM builder with a custom entity resolver?


Solution

  • Use a custom XMLReader.

    XMLReader reader = XMLReaderFactory.createXMLReader();
    reader.setEntityResolver(new EntityResolver(){...});
    Builder builder = new Builder( reader );