Merge branch 'master' of git.springsource.org:spring-integration/spring-integration

This commit is contained in:
Oleg Zhurakousky
2010-09-15 21:08:53 -04:00

View File

@@ -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)));