Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 21314105C5 for ; Wed, 18 Sep 2013 13:54:42 +0000 (UTC) Received: (qmail 30029 invoked by uid 500); 18 Sep 2013 13:54:40 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 29998 invoked by uid 500); 18 Sep 2013 13:54:40 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 29990 invoked by uid 99); 18 Sep 2013 13:54:39 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Sep 2013 13:54:39 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of dalewking@gmail.com designates 209.85.212.175 as permitted sender) Received: from [209.85.212.175] (HELO mail-wi0-f175.google.com) (209.85.212.175) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Sep 2013 13:54:33 +0000 Received: by mail-wi0-f175.google.com with SMTP id ez12so6442787wid.14 for ; Wed, 18 Sep 2013 06:54:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=f7rNCHdpcaROGrL9cmSy7alQATjgUKRNprpN06YUXTI=; b=F+hBfq+FWeLOc8l2iHbAFbZauHcb5M9PFZPvZ/h/8RN76qzIMkFZMiyNht88y0aK7d f31FELV6obTiKH1Kctry/+Qgc580cxJKpe1zVRJ0IdFrPng1cjbRoTYibAThUpYViuac WAT8qFSiuosHYDN5u6vYoPehd9RYzUsX8bRT4GSExPfjG5ykRKWY+6dLuEbn4bQ3nwhw SmDhCghBdj/KM4MGkD196HFONgrxi8ti81+GvxFWcB/qmQ1Kft99lPduqsQh3LeWY60r /FGMQIuko7NqONNgN8DzXcnpqYDirq/lR1zrC3N0nBITPjnozabVCLLAIV9q3jkCtTV8 1PwA== MIME-Version: 1.0 X-Received: by 10.180.211.206 with SMTP id ne14mr7313258wic.30.1379512453757; Wed, 18 Sep 2013 06:54:13 -0700 (PDT) Received: by 10.194.240.228 with HTTP; Wed, 18 Sep 2013 06:54:13 -0700 (PDT) Date: Wed, 18 Sep 2013 09:54:13 -0400 Message-ID: Subject: Route HANGS processing XML with external DOCTYPE declaration From: Dale King To: users@camel.apache.org Content-Type: multipart/alternative; boundary=001a11c37d44c5028204e6a8c5e1 X-Virus-Checked: Checked by ClamAV on apache.org --001a11c37d44c5028204e6a8c5e1 Content-Type: text/plain; charset=ISO-8859-1 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 --001a11c37d44c5028204e6a8c5e1--