01: /*
02: * Copyright 2006 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.validation;
18:
19: import java.io.IOException;
20: import javax.xml.transform.Source;
21:
22: import org.xml.sax.SAXParseException;
23:
24: /**
25: * Simple processor that validates a given <code>Source</code>. Can be created via the
26: * <code>XmlValidatorFactory</code>.
27: * <p/>
28: * <code>XmlValidator</code> instances are designed to be thread safe.
29: *
30: * @author Arjen Poutsma
31: * @see XmlValidatorFactory#createValidator(org.springframework.core.io.Resource,String)
32: * @since 1.0.0
33: */
34: public interface XmlValidator {
35:
36: /**
37: * Validates the given <code>Source</code>, and returns an array of <code>SAXParseException</code>s as result. The
38: * array will be empty if no validation errors are found.
39: *
40: * @param source the input document
41: * @return an array of <code>SAXParseException</code>s
42: * @throws IOException if the <code>source</code> cannot be read
43: * @throws XmlValidationException if the <code>source</code> cannot be validated
44: */
45: SAXParseException[] validate(Source source) throws IOException;
46:
47: }
|