Hi I logged a ticket about this to not forget https://issues.apache.org/jira/browse/CAMEL-6897
Seems useful especially if you want to make sure the server dont try to load external resources such as a DTD file. On Wed, Sep 18, 2013 at 4:06 PM, Claus Ibsen <[email protected]> wrote: > Hi Dale > > Sounds like a good idea to have a way of configuring this easily in Camel. > Feel free to log a JIRA and attach your code. > > Though wonder also how we can make it easier to set any other custom > features as well. > > > > On Wed, Sep 18, 2013 at 3:54 PM, Dale King <[email protected]> wrote: >> I've used xpath routes previously and had no problem. I tried doing a split >> with xpath on an XHTML document however and the route just hangs. It >> doesn't throw an exception or simply fail to find a match for the XPath, it >> just hangs. >> >> After 4-5 hours of debugging the issue, I have discovered it is because the >> XHTML contains an external DTD declaration (a DOCTYPE) as it should. When >> converting the XML content to a DOM it tries to load the external DTD which >> never completes, causing the route to hang. >> >> The solution I have found is to add the following class and declare it as a >> bean in the Spring configuration and Spring will autowire it into the >> XmlConverter, but I would be interested in knowing anything better to avoid >> the lockup: >> >> @SuppressWarnings("restriction") >> public class NoExternalDtdDocumentBuilderFactory extends >> DocumentBuilderFactoryImpl >> { >> public NoExternalDtdDocumentBuilderFactory() throws >> ParserConfigurationException >> { >> setValidating(false); >> setNamespaceAware(true); >> setFeature("http://xml.org/sax/features/namespaces", false); >> setFeature("http://xml.org/sax/features/validation", false); >> setFeature(" >> http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false); >> setFeature(" >> http://apache.org/xml/features/nonvalidating/load-external-dtd", false); >> } >> } >> >> >> -- >> Dale King > > > > -- > Claus Ibsen > ----------------- > Red Hat, Inc. > Email: [email protected] > Twitter: davsclaus > Blog: http://davsclaus.com > Author of Camel in Action: http://www.manning.com/ibsen -- Claus Ibsen ----------------- Red Hat, Inc. Email: [email protected] Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
