diff --git a/spring-integration-xml/src/main/java/org/springframework/integration/xml/DefaultXmlPayloadConverter.java b/spring-integration-xml/src/main/java/org/springframework/integration/xml/DefaultXmlPayloadConverter.java index 09b3f28f75..7a85368523 100644 --- a/spring-integration-xml/src/main/java/org/springframework/integration/xml/DefaultXmlPayloadConverter.java +++ b/spring-integration-xml/src/main/java/org/springframework/integration/xml/DefaultXmlPayloadConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package org.springframework.integration.xml; +import java.io.File; import java.io.StringReader; import javax.xml.parsers.DocumentBuilder; @@ -55,6 +56,14 @@ public class DefaultXmlPayloadConverter implements XmlPayloadConverter { if (object instanceof Document) { return (Document) object; } + if (object instanceof File) { + try { + return getDocumentBuilder().parse((File) object); + } + catch (Exception e) { + throw new MessagingException("failed to parse File payload '" + object + "'", e); + } + } if (object instanceof String) { try { return getDocumentBuilder().parse(new InputSource(new StringReader((String) object)));