01: /*
02: * Copyright 2007 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16:
17: package org.springframework.xml.transform;
18:
19: import java.io.IOException;
20: import javax.xml.transform.sax.SAXSource;
21:
22: import org.springframework.core.io.Resource;
23: import org.springframework.xml.sax.SaxUtils;
24:
25: /**
26: * Convenient subclass of {@link SAXSource} that reads from a Spring {@link Resource}. The resource to be read can be
27: * set via the constructor.
28: *
29: * @author Arjen Poutsma
30: * @since 1.0.0
31: */
32: public class ResourceSource extends SAXSource {
33:
34: /**
35: * Initializes a new instance of the <code>ResourceSource</code> with the given resource.
36: *
37: * @param content the content
38: */
39: public ResourceSource(Resource content) throws IOException {
40: super(SaxUtils.createInputSource(content));
41: }
42:
43: }
|